From: Peter Palfrader Date: Fri, 1 Sep 2017 09:29:18 +0000 (+0000) Subject: move roles::postgresql_server to postgres::backup_source X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=acafab70dc47db33070f0c8c1306eee0841339c9;p=mirror%2Fdsa-puppet.git move roles::postgresql_server to postgres::backup_source --- diff --git a/modules/postgres/manifests/backup_source.pp b/modules/postgres/manifests/backup_source.pp new file mode 100644 index 000000000..81d4a8ee1 --- /dev/null +++ b/modules/postgres/manifests/backup_source.pp @@ -0,0 +1,20 @@ +class postgres::backup_source { + file { "/usr/local/bin/pg-backup-file": + mode => '0555', + source => "puppet:///modules/roles/postgresql_server/pg-backup-file", + } + file { "/usr/local/bin/pg-receive-file-from-backup": + mode => '0555', + source => "puppet:///modules/roles/postgresql_server/pg-receive-file-from-backup", + } + file { "/etc/dsa/pg-backup-file.conf": + content => template('roles/postgresql_server/pg-backup-file.conf.erb'), + } + + if ! $::postgresql_key { + exec { 'create-postgresql-key': + command => '/bin/su - postgres -c \'mkdir -p -m 02700 .ssh && ssh-keygen -C "`whoami`@`hostname` (`date +%Y-%m-%d`)" -P "" -f .ssh/id_rsa -q\'', + onlyif => '/usr/bin/getent passwd postgres > /dev/null && ! [ -e /var/lib/postgresql/.ssh/id_rsa ]' + } + } +} diff --git a/modules/roles/manifests/init.pp b/modules/roles/manifests/init.pp index 6e6976eab..45ca3a5b4 100644 --- a/modules/roles/manifests/init.pp +++ b/modules/roles/manifests/init.pp @@ -317,7 +317,7 @@ class roles { } if has_role('postgresql_server') { - include roles::postgresql_server + include postgres::backup_source } if has_role('bacula_director') { diff --git a/modules/roles/manifests/postgresql_server.pp b/modules/roles/manifests/postgresql_server.pp deleted file mode 100644 index 25aa3e5dd..000000000 --- a/modules/roles/manifests/postgresql_server.pp +++ /dev/null @@ -1,20 +0,0 @@ -class roles::postgresql_server { - file { "/usr/local/bin/pg-backup-file": - mode => '0555', - source => "puppet:///modules/roles/postgresql_server/pg-backup-file", - } - file { "/usr/local/bin/pg-receive-file-from-backup": - mode => '0555', - source => "puppet:///modules/roles/postgresql_server/pg-receive-file-from-backup", - } - file { "/etc/dsa/pg-backup-file.conf": - content => template('roles/postgresql_server/pg-backup-file.conf.erb'), - } - - if ! $::postgresql_key { - exec { 'create-postgresql-key': - command => '/bin/su - postgres -c \'mkdir -p -m 02700 .ssh && ssh-keygen -C "`whoami`@`hostname` (`date +%Y-%m-%d`)" -P "" -f .ssh/id_rsa -q\'', - onlyif => '/usr/bin/getent passwd postgres > /dev/null && ! [ -e /var/lib/postgresql/.ssh/id_rsa ]' - } - } -}