From 60e3d192b636a817ee75524e75d4e8c953841a49 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Tue, 24 Sep 2019 15:52:20 +0200 Subject: [PATCH 1/1] rename bacula::node to bacula::director::client --- data/common.yaml | 1 + modules/bacula/manifests/client.pp | 5 ++++- modules/bacula/manifests/client/storage.pp | 9 +++++++++ modules/bacula/manifests/director.pp | 2 +- .../manifests/{node.pp => director/client.pp} | 17 +++++++++-------- .../dir-per-client.erb} | 0 6 files changed, 24 insertions(+), 10 deletions(-) create mode 100644 modules/bacula/manifests/client/storage.pp rename modules/bacula/manifests/{node.pp => director/client.pp} (69%) rename modules/bacula/templates/{per-client.conf.erb => director/dir-per-client.erb} (100%) diff --git a/data/common.yaml b/data/common.yaml index 4cd0c195d..27d8a53e5 100644 --- a/data/common.yaml +++ b/data/common.yaml @@ -36,6 +36,7 @@ bacula::director::db_address: 'postgresql-manda-01.debian.org' bacula::director::db_port: 5432 bacula::director::db_sslca: '/etc/ssl/debian/certs/ca.crt' +bacula::client::director_server: dinis.debian.org bacula::client::storage_server: storace.debian.org diff --git a/modules/bacula/manifests/client.pp b/modules/bacula/manifests/client.pp index 200f4b01b..8bf5daae3 100644 --- a/modules/bacula/manifests/client.pp +++ b/modules/bacula/manifests/client.pp @@ -3,10 +3,12 @@ # this mostly configures the file daemon, but also firewall rules and # fragments to sent to the other servers. # +# @param director_server The director server that controls this client's backups # @param storage_server The storage server to use for this client # @param port_fd Port that bacula-fd listens on # @param ensure present or absent class bacula::client( + String $director_server, String $storage_server, Integer $port_fd = 9102, Enum['present', 'absent'] $ensure = defined(Class['bacula::not_a_client']) ? { true => 'absent', default => 'present' }, @@ -21,8 +23,9 @@ class bacula::client( tag => "bacula::to-storage::${storage_server}" } - @@bacula::node { $::fqdn: + @@bacula::director::client { $::fqdn: port_fd => $port_fd, + tag => "bacula::to-director::${director_server}" } @@concat::fragment { "bacula-dsa-client-list::${::fqdn}": diff --git a/modules/bacula/manifests/client/storage.pp b/modules/bacula/manifests/client/storage.pp new file mode 100644 index 000000000..716483c8e --- /dev/null +++ b/modules/bacula/manifests/client/storage.pp @@ -0,0 +1,9 @@ +# Bacula configuration for a client, pushed from the storage. +# +# This is stored config by a storage and then collected on the client. +# +define bacula::client::storage( +) { + include bacula::client + +} diff --git a/modules/bacula/manifests/director.pp b/modules/bacula/manifests/director.pp index cb7afc3cf..956374915 100644 --- a/modules/bacula/manifests/director.pp +++ b/modules/bacula/manifests/director.pp @@ -67,7 +67,7 @@ class bacula::director( notify => Exec['bacula-director reload'] } - Bacula::Node<<| |>> + Bacula::Director::Client<<| tag == "bacula::to-director::${::fqdn}" |>> package { 'bacula-console': ensure => installed; diff --git a/modules/bacula/manifests/node.pp b/modules/bacula/manifests/director/client.pp similarity index 69% rename from modules/bacula/manifests/node.pp rename to modules/bacula/manifests/director/client.pp index 38ce3059a..dc4dafc5e 100644 --- a/modules/bacula/manifests/node.pp +++ b/modules/bacula/manifests/director/client.pp @@ -3,8 +3,10 @@ # This is stored config by a client, collected on the director # # @param port_fd port that this node's bacula-fd is listening on -define bacula::node ( +# @param client The name of the client (relevant for device names, media type names, etc.) +define bacula::director::client ( Integer $port_fd = 9102, + String $client = $name, ) { include bacula @@ -19,19 +21,18 @@ define bacula::node ( $bacula_ssl_client_cert = $bacula::bacula_ssl_client_cert $bacula_ssl_client_key = $bacula::bacula_ssl_client_key - $bacula_client_name = "${name}-fd" - $bacula_client_secret = hkdf('/etc/puppet/secret', "bacula-fd-${name}") - $client = $name + $bacula_client_name = "${client}-fd" + $bacula_client_secret = hkdf('/etc/puppet/secret', "bacula-fd-${client}") - file { "/etc/bacula/conf.d/${name}.conf": - content => template('bacula/per-client.conf.erb'), + file { "/etc/bacula/conf.d/${client}.conf": + content => template('bacula/director/dir-per-client.erb'), mode => '0440', group => bacula, notify => Exec['bacula-director reload'] } - file { "/etc/bacula/storages-list.d/${name}.storage": - content => "${bacula::bacula_filestor_name}-${client}\n", + file { "/etc/bacula/storages-list.d/${client}.storage": + content => "${bacula::bacula_filestor_client}-${client}\n", mode => '0440', group => bacula, notify => Exec['bacula-director reload'] diff --git a/modules/bacula/templates/per-client.conf.erb b/modules/bacula/templates/director/dir-per-client.erb similarity index 100% rename from modules/bacula/templates/per-client.conf.erb rename to modules/bacula/templates/director/dir-per-client.erb -- 2.20.1