From fdf21cbda2ed9d025c8300ab2515ba0c0ef296d9 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Sun, 29 Sep 2019 15:27:54 +0200 Subject: [PATCH] Make the bacula director node request DB access from its role --- data/nodes/dinis.debian.org.yaml | 2 +- modules/roles/manifests/bacula/director.pp | 18 ++++++++++++++++++ .../manifests/postgresql/cluster_bacula.pp | 8 -------- 3 files changed, 19 insertions(+), 9 deletions(-) create mode 100644 modules/roles/manifests/bacula/director.pp diff --git a/data/nodes/dinis.debian.org.yaml b/data/nodes/dinis.debian.org.yaml index 0ea1f50dc..d6bec0862 100644 --- a/data/nodes/dinis.debian.org.yaml +++ b/data/nodes/dinis.debian.org.yaml @@ -1,3 +1,3 @@ --- classes: - - bacula::director + - roles::bacula::director diff --git a/modules/roles/manifests/bacula/director.pp b/modules/roles/manifests/bacula/director.pp new file mode 100644 index 000000000..f069540e6 --- /dev/null +++ b/modules/roles/manifests/bacula/director.pp @@ -0,0 +1,18 @@ +# +# bacula director node +# +class roles::bacula::director( +) { + include bacula::director + + $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', 'bacula-dinis-reader', 'nagios'], + address => $base::public_addresses, + } +} diff --git a/modules/roles/manifests/postgresql/cluster_bacula.pp b/modules/roles/manifests/postgresql/cluster_bacula.pp index eeebd8351..12fc33b4e 100644 --- a/modules/roles/manifests/postgresql/cluster_bacula.pp +++ b/modules/roles/manifests/postgresql/cluster_bacula.pp @@ -12,12 +12,4 @@ class roles::postgresql::cluster_bacula { pg_port => $pg_port, manage_hba => true, } - postgres::cluster::hba_entry { 'bacula-dir': - pg_version => $pg_version, - pg_cluster => $pg_cluster, - pg_port => $pg_port, - database => 'bacula', - user => ['bacula', 'bacula-dinis-reader', 'nagios'], - address => ['82.195.75.77', '2001:41b8:202:deb::311:77'], - } } -- 2.20.1