diff options
Diffstat (limited to 'personal_infra/puppet/modules/postgres')
| -rw-r--r-- | personal_infra/puppet/modules/postgres/manifests/init.pp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/personal_infra/puppet/modules/postgres/manifests/init.pp b/personal_infra/puppet/modules/postgres/manifests/init.pp new file mode 100644 index 00000000..40fd5726 --- /dev/null +++ b/personal_infra/puppet/modules/postgres/manifests/init.pp @@ -0,0 +1,26 @@ +class postgres($pg_hba_conf) { + package {'pgdg-redhat-repo': + source => 'https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm', + } + -> + package {'postgresql15-server':} + -> + exec {'/usr/pgsql-15/bin/postgresql-15-setup initdb': + creates => '/var/lib/pgsql/15/data/PG_VERSION', + } + -> + [ + file {'/var/lib/pgsql/15/data/pg_hba.conf': + # template at /usr/pgsql-15/share/pg_hba.conf.sample + content => $pg_hba_conf, + }, + exec {'/bin/sed -i "s/#listen_addresses = \'localhost\'/listen_addresses = \'*\' /" /var/lib/pgsql/15/data/postgresql.conf': + unless => '/bin/grep "listen_addresses = \'\\*\'" /var/lib/pgsql/15/data/postgresql.conf', + } + ] + ~> + service {'postgresql-15': + ensure => running, + enable => true, + } +} |
