From 710c80f43aed35f4c0f061274b525ae422392975 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Tue, 24 Sep 2019 14:24:57 +0200 Subject: [PATCH] backup-path should be something that only the storage system should need to care about --- modules/bacula/manifests/init.pp | 2 -- modules/bacula/manifests/storage.pp | 6 +++++- modules/bacula/manifests/storage_per_node.pp | 6 ++---- modules/bacula/templates/storage-per-client.conf.erb | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/bacula/manifests/init.pp b/modules/bacula/manifests/init.pp index 5084ffb0a..0caa7dab8 100644 --- a/modules/bacula/manifests/init.pp +++ b/modules/bacula/manifests/init.pp @@ -16,8 +16,6 @@ class bacula ( String $bacula_storage_address = 'storace.debian.org', Integer $bacula_storage_port = 9103, - String $bacula_backup_path = '/srv/bacula', - String $bacula_director_secret = hkdf('/etc/puppet/secret', "bacula-dir-${::hostname}"), String $bacula_db_secret = hkdf('/etc/puppet/secret', "bacula-db-${::hostname}"), String $bacula_storage_secret = hkdf('/etc/puppet/secret', "bacula-sd-${bacula_storage_name}"), diff --git a/modules/bacula/manifests/storage.pp b/modules/bacula/manifests/storage.pp index 3c01e58a9..34bd6491b 100644 --- a/modules/bacula/manifests/storage.pp +++ b/modules/bacula/manifests/storage.pp @@ -1,5 +1,9 @@ # the bacula storage node -class bacula::storage inherits bacula { +# +# @param backup_path the directory where backups should be stored +class bacula::storage ( + String $backup_path = '/srv/bacula', +) inherits bacula { package { 'bacula-sd': ensure => installed } diff --git a/modules/bacula/manifests/storage_per_node.pp b/modules/bacula/manifests/storage_per_node.pp index d11ac034d..e6f842582 100644 --- a/modules/bacula/manifests/storage_per_node.pp +++ b/modules/bacula/manifests/storage_per_node.pp @@ -1,11 +1,9 @@ # bacula storage for node. This is stored config by a client, collected on the storage define bacula::storage_per_node() { - - include bacula + include bacula::storage $bacula_filestor_device = $bacula::bacula_filestor_device $bacula_filestor_name = $bacula::bacula_filestor_name - $bacula_backup_path = $bacula::bacula_backup_path $bacula_client_name = "${name}-fd" $client = $name @@ -17,7 +15,7 @@ define bacula::storage_per_node() { group => bacula, notify => Exec['bacula-sd restart-when-idle'], ; - "${bacula_backup_path}/${name}": + "${bacula::storage::backup_path}/${name}": ensure => directory, mode => '0755', owner => bacula, diff --git a/modules/bacula/templates/storage-per-client.conf.erb b/modules/bacula/templates/storage-per-client.conf.erb index e7c9ceec1..bd7a6781d 100644 --- a/modules/bacula/templates/storage-per-client.conf.erb +++ b/modules/bacula/templates/storage-per-client.conf.erb @@ -6,7 +6,7 @@ Device { Name = "<%= @bacula_filestor_device %>-<%= @client %>" Media Type = "<%= @bacula_filestor_name %>-<%= @client %>" - Archive Device = "<%= @bacula_backup_path %>/<%= @client %>" + Archive Device = "<%= scope['bacula::storage::backup_path'] %>/<%= @client %>" LabelMedia = yes; Random Access = Yes; AutomaticMount = yes; -- 2.20.1