From 43932181cceeb28d21a7d03ee5c3584e1a29d132 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Sun, 29 Sep 2019 15:24:51 +0200 Subject: [PATCH] Make the bacula storage node request DB access from its role --- data/nodes/storace.debian.org.yaml | 2 +- modules/roles/manifests/bacula/storage.pp | 18 ++++++++++++++++++ .../manifests/postgresql/cluster_bacula.pp | 8 -------- 3 files changed, 19 insertions(+), 9 deletions(-) create mode 100644 modules/roles/manifests/bacula/storage.pp diff --git a/data/nodes/storace.debian.org.yaml b/data/nodes/storace.debian.org.yaml index ca972f82a..5d97af7aa 100644 --- a/data/nodes/storace.debian.org.yaml +++ b/data/nodes/storace.debian.org.yaml @@ -1,5 +1,5 @@ --- classes: - - bacula::storage + - roles::bacula::storage - postgres::backup_server - profile::ipsec::fasolo_storace diff --git a/modules/roles/manifests/bacula/storage.pp b/modules/roles/manifests/bacula/storage.pp new file mode 100644 index 000000000..e668148c8 --- /dev/null +++ b/modules/roles/manifests/bacula/storage.pp @@ -0,0 +1,18 @@ +# +# bacula storage node +# +class roles::bacula::storage( +) { + include bacula::storage + + $pg_server = lookup('bacula::director::db_address') + $pg_port = lookup('bacula::director::db_port') + + @@postgres::cluster::hba_entry { 'bacula-sd': + tag => "postgres::cluster::${pg_port}::hba::${pg_server}", + pg_port => $pg_port, + database => 'bacula', + user => "bacula-${::hostname}-reader", + address => $base::public_addresses, + } +} diff --git a/modules/roles/manifests/postgresql/cluster_bacula.pp b/modules/roles/manifests/postgresql/cluster_bacula.pp index 1a853556a..eeebd8351 100644 --- a/modules/roles/manifests/postgresql/cluster_bacula.pp +++ b/modules/roles/manifests/postgresql/cluster_bacula.pp @@ -20,12 +20,4 @@ class roles::postgresql::cluster_bacula { user => ['bacula', 'bacula-dinis-reader', 'nagios'], address => ['82.195.75.77', '2001:41b8:202:deb::311:77'], } - postgres::cluster::hba_entry { 'bacula-sd': - pg_version => $pg_version, - pg_cluster => $pg_cluster, - pg_port => $pg_port, - database => 'bacula', - user => 'bacula-storace-reader', - address => ['93.94.130.161', '2a02:158:380:280::161'], - } } -- 2.20.1