Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add variable director_name_suffix #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions manifests/client.pp
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,18 @@
# limitations under the License.
#
class bacula::client (
$director_password = '',
$director_server = undef,
$plugin_dir = undef,
$tls_allowed_cn = [],
$tls_ca_cert = undef,
$tls_ca_cert_dir = undef,
$tls_cert = undef,
$tls_key = undef,
$tls_require = 'yes',
$tls_verify_peer = 'yes',
$use_tls = false
$director_password = '',
$director_server = undef,
$director_name_suffix = ':director',
$plugin_dir = undef,
$tls_allowed_cn = [],
$tls_ca_cert = undef,
$tls_ca_cert_dir = undef,
$tls_cert = undef,
$tls_key = undef,
$tls_require = 'yes',
$tls_verify_peer = 'yes',
$use_tls = false
) {
include ::bacula::params

Expand Down
21 changes: 11 additions & 10 deletions manifests/console.pp
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,17 @@
# limitations under the License.
#
class bacula::console (
$console_template = 'bacula/bconsole.conf.erb',
$director_password = '',
$director_server = undef,
$tls_ca_cert = undef,
$tls_ca_cert_dir = undef,
$tls_cert = undef,
$tls_key = undef,
$tls_require = 'yes',
$tls_verify_peer = 'yes',
$use_tls = false
$console_template = 'bacula/bconsole.conf.erb',
$director_password = '',
$director_server = undef,
$director_name_suffix = ':director',
$tls_ca_cert = undef,
$tls_ca_cert_dir = undef,
$tls_cert = undef,
$tls_key = undef,
$tls_require = 'yes',
$tls_verify_peer = 'yes',
$use_tls = false
) {
include ::bacula::params

Expand Down
1 change: 1 addition & 0 deletions manifests/director.pp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
$dir_template = 'bacula/bacula-dir.conf.erb',
$director_password = '',
$director_server = undef,
$director_name_suffix = ':director'
$mail_to = undef,
$mail_to_daemon = undef,
$mail_to_on_error = undef,
Expand Down
49 changes: 28 additions & 21 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
# The director's password
# [*director_server*]
# The FQDN of the bacula director
# [*director_name_suffix*]
# The second part used in director name
# [*director_template*]
# The ERB template to use for configuring the director instead of the one
# included with the module
Expand Down Expand Up @@ -197,6 +199,7 @@
$db_user_host = undef,
$director_password = '',
$director_server = undef,
$director_name_suffix = ':director',
$director_template = undef,
$is_client = true,
$is_director = false,
Expand Down Expand Up @@ -331,6 +334,7 @@
dir_template => $director_template,
director_password => $director_password,
director_server => $director_server_real,
director_name_suffix => $director_name_suffix,
mail_to => $mail_to,
mail_to_daemon => $mail_to_daemon,
mail_to_on_error => $mail_to_on_error,
Expand Down Expand Up @@ -373,6 +377,7 @@
db_backend => $db_backend,
director_password => $director_password,
director_server => $director_server_real,
director_name_suffix => $director_name_suffix,
plugin_dir => $plugin_dir,
storage_default_mount => $storage_default_mount,
storage_server => $storage_server_real,
Expand All @@ -390,32 +395,34 @@

if $is_client {
class { '::bacula::client':
director_server => $director_server_real,
director_password => $director_password,
plugin_dir => $plugin_dir,
tls_allowed_cn => $tls_allowed_cn,
tls_ca_cert => $tls_ca_cert,
tls_ca_cert_dir => $tls_ca_cert_dir,
tls_cert => $tls_cert,
tls_key => $tls_key,
tls_require => $tls_require,
tls_verify_peer => $tls_verify_peer,
use_tls => $use_tls,
director_server => $director_server_real,
director_password => $director_password,
director_name_suffix => $director_name_suffix,
plugin_dir => $plugin_dir,
tls_allowed_cn => $tls_allowed_cn,
tls_ca_cert => $tls_ca_cert,
tls_ca_cert_dir => $tls_ca_cert_dir,
tls_cert => $tls_cert,
tls_key => $tls_key,
tls_require => $tls_require,
tls_verify_peer => $tls_verify_peer,
use_tls => $use_tls,
}
}

if $manage_console_real {
class { '::bacula::console':
console_template => $console_template,
director_password => $director_password,
director_server => $director_server_real,
tls_ca_cert => $tls_ca_cert,
tls_ca_cert_dir => $tls_ca_cert_dir,
tls_cert => $tls_cert,
tls_key => $tls_key,
tls_require => $tls_require,
tls_verify_peer => $tls_verify_peer,
use_tls => $use_tls,
console_template => $console_template,
director_password => $director_password,
director_server => $director_server_real,
director_name_suffix => $director_name_suffix,
tls_ca_cert => $tls_ca_cert,
tls_ca_cert_dir => $tls_ca_cert_dir,
tls_cert => $tls_cert,
tls_key => $tls_key,
tls_require => $tls_require,
tls_verify_peer => $tls_verify_peer,
use_tls => $use_tls,
}
}

Expand Down
8 changes: 4 additions & 4 deletions manifests/params/validate.pp
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@
}
}

# Validate the director and storage servers given are fully qualified
# domain names
validate_re($director_server, '^[a-z0-9_-]+(\.[a-z0-9_-]+){2,}$')
validate_re($storage_server, '^[a-z0-9_-]+(\.[a-z0-9_-]+){2,}$')
# Validate the director and storage servers given are valid
# hostnames
validate_re($director_server, '^[a-z0-9_-]+(\.[a-z0-9_-]+)*$')
validate_re($storage_server, '^[a-z0-9_-]+(\.[a-z0-9_-]+)*$')

# Validate server values aren't empty
if empty($director_server) {
Expand Down
1 change: 1 addition & 0 deletions manifests/storage.pp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
$db_backend = 'sqlite',
$director_password = '',
$director_server = undef,
$director_name_suffix = ':director'
$plugin_dir = undef,
$storage_default_mount = '/mnt/bacula',
$storage_server = undef,
Expand Down
6 changes: 3 additions & 3 deletions templates/bacula-dir.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Define the name of this director so other clients can
# connect to it and work with our system
Director {
Name = "<%= @director_server_real -%>:director"
Name = "<%= @director_server_real -%><%= @director_name_suffix %>"
Query File = "/etc/bacula/scripts/query.sql"
Working Directory = "/var/lib/bacula"
PID Directory = "/var/run/bacula"
Expand Down Expand Up @@ -61,7 +61,7 @@ Messages {
# WARNING! the following will create a file that you must cycle from
# time to time as it will grow indefinitely. However, it will
# also keep all your messages if they scroll off the console.
Append = "/var/log/bacula/<%= @director_server_real -%>:director.log" = all, !skipped
Append = "/var/log/bacula/<%= @director_server_real -%><%= @director_name_suffix %>.log" = all, !skipped
Catalog = all
}

Expand All @@ -71,7 +71,7 @@ Messages {
Mail Command = "/usr/sbin/bsmtp -h localhost -f bacula@<%= scope.lookupvar('::fqdn') -%> -s \"Bacula Notice (from Director %d)\" %r"
Mail = <%= @mail_to_daemon_real -%> = all, !skipped
Console = all, !skipped, !saved
Append = "/var/log/bacula/<%= @director_server_real -%>:director.log" = all, !skipped
Append = "/var/log/bacula/<%= @director_server_real -%><%= @director_name_suffix %>.log" = all, !skipped
}

<% if @use_console -%>
Expand Down
6 changes: 3 additions & 3 deletions templates/bacula-fd.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
#
# Bacula File Daemon Configuration
# for <%= scope.lookupvar('::fqdn') %>
# via <%= @director_server_real -%>:director (<%= @director_server_real -%>)
# via <%= @director_server_real -%><%= @director_name_suffix %> (<%= @director_server_real -%>)

# Configure the Director which will manage this host's backups
Director {
Name = "<%= @director_server_real -%>:director"
Name = "<%= @director_server_real -%><%= @director_name_suffix %>"
Password = "<%= @director_password -%>"
<% if @use_tls -%>
TLS Enable = yes
Expand Down Expand Up @@ -54,5 +54,5 @@ FileDaemon {
# Finally, set where the messages are going to go
Messages {
Name = "<%= @director_server_real -%>:messages:standard"
Director = "<%= @director_server_real -%>:director" = all, !skipped, !restored
Director = "<%= @director_server_real -%><%= director_name_suffix %>" = all, !skipped, !restored
}
6 changes: 3 additions & 3 deletions templates/bacula-sd.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
#
# Bacula Storage Daemon Configuration
# for <%= @storage_server_real %>
# via <%= @director_server_real -%>:director (<%= @director_server_real -%>)
# via <%= @director_server_real -%><%= @director_name_suffix %> (<%= @director_server_real -%>)

# Configure the Director which will manage this Storage Daemon, and the
# Director through which we'll send our messages (will be the same) one.
Director {
Name = "<%= @director_server_real -%>:director"
Name = "<%= @director_server_real -%><%= @director_name_suffix %>"
Password = "<%= @director_password -%>"
<% if @use_tls -%>
TLS Enable = yes
Expand All @@ -31,7 +31,7 @@ Director {

Messages {
Name = "<%= @storage_server_real -%>:messages:standard"
Director = "<%= @director_server_real -%>:director" = all
Director = "<%= @director_server_real -%><%= @director_name_suffix %>" = all
}

# Configure the basic details for the Storage Daemon on this server
Expand Down
20 changes: 10 additions & 10 deletions templates/bconsole.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
#
# Bacula Console Configuration
# for <%= scope.lookupvar('::fqdn') %>
# to <%= director_server_real -%>:director (<%= director_server_real -%>)
# to <%= @director_server_real -%><%= @director_name_suffix %> (<%= @director_server_real -%>)

Director {
Name = "<%= director_server_real -%>:director"
Address = <%= director_server_real %>
Password = "<%= director_password %>"
<% if use_tls -%>
Name = "<%= @director_server_real -%><%= @director_name_suffix %>"
Address = <%= @director_server_real %>
Password = "<%= @director_password %>"
<% if @use_tls -%>
TLS Enable = yes
TLS Require = <%= tls_require %>
TLS Require = <%= @tls_require %>
<% if @tls_ca_cert -%>
TLS CA Certificate File = <%= tls_ca_cert %>
TLS CA Certificate File = <%= @tls_ca_cert %>
<% end -%>
<% if @tls_ca_cert_dir -%>
TLS CA Certificate Dir = <%= tls_ca_cert_dir %>
TLS CA Certificate Dir = <%= @tls_ca_cert_dir %>
<% end -%>
TLS Certificate = <%= tls_cert %>
TLS Key = <%= tls_key %>
TLS Certificate = <%= @tls_cert %>
TLS Key = <%= @tls_key %>
<% end -%>
}