Open
Description
The issue
The following does not work on Rocky Linux 8 without first disabling the yum postgresql module.
class { 'postgresql::globals':
manage_package_repo => true,
version => '14',
}->
class { 'postgresql::server':
}
It returns the following error
Error: Execution of '/bin/dnf -d 0 -e 1 -y install postgresql14-server' returned 1: Error: Unable to find a match: postgresql14-server
Error: /Stage[main]/Postgresql::Server::Install/Package[postgresql-server]/ensure: change from 'purged' to 'present' failed: Execution of '/bin/dnf -d 0 -e 1 -y install postgresql14-server' returned 1: Error: Unable to find a match: postgresql14-server (corrective)
Notice: /Stage[main]/Postgresql::Server::Initdb/File[/var/lib/pgsql/14/data]: Dependency Package[postgresql-server] has failures: true
Warning: /Stage[main]/Postgresql::Server::Initdb/File[/var/lib/pgsql/14/data]: Skipping because of failed dependencies
Warning: /Stage[main]/Postgresql::Server::Initdb/Exec[postgresql_initdb]: Skipping because of failed dependencies
Warning: /Stage[main]/Postgresql::Server::Config/File[/var/lib/pgsql/14/data/postgresql.conf]: Skipping because of failed dependencies
Warning: /Stage[main]/Postgresql::Server::Config/File[systemd-conf-dir]: Skipping because of failed dependencies
Warning: /Stage[main]/Postgresql::Server::Config/File[systemd-override]: Skipping because of failed dependencies
Warning: /Stage[main]/Postgresql::Server::Config/File[old-systemd-override]: Skipping because of failed dependencies
Warning: /Stage[main]/Postgresql::Server::Config/Exec[restart-systemd]: Skipping because of failed dependencies
Warning: /Stage[main]/Postgresql::Server::Config/Concat[/var/lib/pgsql/14/data/pg_hba.conf]/Concat_file[/var/lib/pgsql/14/data/pg_hba.conf]: Skipping because of failed dependencies
Warning: /Stage[main]/Postgresql::Server::Config/Concat[/var/lib/pgsql/14/data/pg_hba.conf]/File[/var/lib/pgsql/14/data/pg_hba.conf]: Skipping because of failed dependencies
Warning: /Stage[main]/Postgresql::Server::Config/Concat[/var/lib/pgsql/14/data/pg_hba.conf]/Concat_fragment[/var/lib/pgsql/14/data/pg_hba.conf_header]: Skipping because of failed dependencies
Warning: /Stage[main]/Postgresql::Server::Config/Postgresql::Server::Config_entry[port]/Postgresql_conf[port]: Skipping because of failed dependencies
Warning: /Stage[main]/Postgresql::Server::Config/Postgresql::Server::Config_entry[data_directory]/Postgresql_conf[data_directory]: Skipping because of failed dependencies
Warning: /Stage[main]/Postgresql::Server::Config/Concat[/var/lib/pgsql/14/data/pg_ident.conf]/Concat_file[/var/lib/pgsql/14/data/pg_ident.conf]: Skipping because of failed dependencies
Warning: /Stage[main]/Postgresql::Server::Config/Concat[/var/lib/pgsql/14/data/pg_ident.conf]/File[/var/lib/pgsql/14/data/pg_ident.conf]: Skipping because of failed dependencies
Warning: /Stage[main]/Postgresql::Server::Config/Concat[/var/lib/pgsql/14/data/pg_ident.conf]/Concat_fragment[/var/lib/pgsql/14/data/pg_ident.conf_header]: Skipping because of failed dependencies
Warning: /Stage[main]/Postgresql::Server::Config/Postgresql::Server::Pg_hba_rule[local access as postgres user]/Concat::Fragment[pg_hba_rule_local access as postgres user]/Concat_fragment[pg_hba_rule_local access as postgres user]: Skipping because of failed dependencies
Warning: /Stage[main]/Postgresql::Server::Config/Postgresql::Server::Pg_hba_rule[local access to database with same name]/Concat::Fragment[pg_hba_rule_local access to database with same name]/Concat_fragment[pg_hba_rule_local access to database with same name]: Skipping because of failed dependencies
Warning: /Stage[main]/Postgresql::Server::Config/Postgresql::Server::Pg_hba_rule[allow localhost TCP access to postgresql user]/Concat::Fragment[pg_hba_rule_allow localhost TCP access to postgresql user]/Concat_fragment[pg_hba_rule_allow localhost TCP access to postgresql user]: Skipping because of failed dependencies
Warning: /Stage[main]/Postgresql::Server::Config/Postgresql::Server::Pg_hba_rule[deny access to postgresql user]/Concat::Fragment[pg_hba_rule_deny access to postgresql user]/Concat_fragment[pg_hba_rule_deny access to postgresql user]: Skipping because of failed dependencies
Warning: /Stage[main]/Postgresql::Server::Config/Postgresql::Server::Pg_hba_rule[allow access to all users]/Concat::Fragment[pg_hba_rule_allow access to all users]/Concat_fragment[pg_hba_rule_allow access to all users]: Skipping because of failed dependencies
Warning: /Stage[main]/Postgresql::Server::Config/Postgresql::Server::Pg_hba_rule[allow access to ipv6 localhost]/Concat::Fragment[pg_hba_rule_allow access to ipv6 localhost]/Concat_fragment[pg_hba_rule_allow access to ipv6 localhost]: Skipping because of failed dependencies
Warning: /Stage[main]/Postgresql::Server::Service/Anchor[postgresql::server::service::begin]: Skipping because of failed dependencies
Warning: /Stage[main]/Postgresql::Server::Service/Service[postgresqld]: Skipping because of failed dependencies
Warning: /Stage[main]/Postgresql::Server::Service/Postgresql_conn_validator[validate_service_is_running]: Skipping because of failed dependencies
Warning: /Stage[main]/Postgresql::Server::Service/Anchor[postgresql::server::service::end]: Skipping because of failed dependencies
Warning: /Stage[main]/Postgresql::Server::Reload/Exec[postgresql_reload]: Skipping because of failed dependencies
To get it to work, i need to disable the yum postresql module first.
dnf -qy module disable postgresql
Working solution
The following snippet solves the issue, and i get postgres14 installed
exec {"Disable yum postgresql module":
path => '/usr/bin:/usr/sbin:/bin',
command => 'dnf -qy module disable postgresql',
onlyif => 'test $(dnf module list --enabled |grep postgresql|wc -l) -gt 0'
}->
class { 'postgresql::globals':
manage_package_repo => true,
version => '14',
}->
class { 'postgresql::server':
}
an other option could be.
exec {"Disable dnf postgresql module":
command => '/bin/dnf -qy module disable postgresql && /bin/touch /etc/.dnf-postgres-disabled',
creates => '/etc/.dnf-postgres-disabled'
}
This works quicker when not having to run dnf module list --enabled |grep postgresql|wc -l