fruit-bowl/environments/production/modules/postgresql/manifests/pgadmin.pp
2025-04-01 17:49:26 +00:00

42 lines
1 KiB
Puppet

class postgresql::pgadmin {
contain postgresql::pgadmin::install
contain postgresql::pgadmin::config
}
class postgresql::pgadmin::install {
apt::source { 'pgadmin':
comment => 'PGAdmin Repo',
location => 'https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/bookworm',
release => 'pgadmin4',
repos => 'main',
key => {
'name' => 'pgadmin.pub',
'source' => 'https://www.pgadmin.org/static/packages_pgadmin_org.pub',
},
include => {
'deb' => true,
},
}
package { 'pgadmin4-web':
ensure => installed
}
}
class postgresql::pgadmin::config {
exec { 'pgadmin-setup':
command => '/usr/pgadmin4/bin/setup-web.sh --yes',
environment => [
"PGADMIN_SETUP_EMAIL=$pg_setup_email",
"PGADMIN_SETUP_PASSWORD=$pg_setup_password"
],
path => ['/usr/bin'],
unless => ['test -f /var/lib/pgadmin', 'test -f /var/log/pgadmin']
}
file { '/usr/pgadmin4/web/config_local.py':
ensure => file,
content => template('postgresql/config_local.py.erb')
}
}