From 754ca2714807d5a6eab1f6a6f13d33dc9b411657 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Tue, 24 Sep 2019 08:42:07 +0200 Subject: [PATCH] And also make database name, user, and ssl ca path parameters --- data/common.yaml | 5 +++-- modules/bacula/manifests/director.pp | 14 ++++++++++---- modules/bacula/templates/bacula-dir.conf.erb | 12 +++++++----- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/data/common.yaml b/data/common.yaml index 78b055156..ff5efc0fe 100644 --- a/data/common.yaml +++ b/data/common.yaml @@ -32,8 +32,9 @@ roles::dns_primary::allow_access: - '2a01:3f0:0:28::25' # bacula # -bacula::director::bacula_db_address: 'postgresql-manda-01.debian.org' -bacula::director::bacula_db_port: 5432 +bacula::director::db_address: 'postgresql-manda-01.debian.org' +bacula::director::db_port: 5432 +bacula::director::db_sslca: '/etc/ssl/debian/certs/ca.crt' # == other variables diff --git a/modules/bacula/manifests/director.pp b/modules/bacula/manifests/director.pp index daa0d6ba0..cb7afc3cf 100644 --- a/modules/bacula/manifests/director.pp +++ b/modules/bacula/manifests/director.pp @@ -1,10 +1,16 @@ # our bacula director # -# @param bacula_db_address hostname of the postgres server for the catalog DB -# @param bacula_db_port port of the postgres server for the catalog DB +# @param db_address hostname of the postgres server for the catalog DB +# @param db_port port of the postgres server for the catalog DB +# @param db_name DB name for the catalog DB +# @param db_user username for the postgres server for the catalog DB +# @param db_sslca SSL CA store for DB access class bacula::director( - String $bacula_db_address = 'postgresql-manda-01.debian.org', - Integer $bacula_db_port = 5432, + String $db_address, + Integer $db_port, + String $db_name = 'bacula', + String $db_user = 'bacula', + Optional[String] $db_sslca = undef, ) inherits bacula { ensure_packages ( [ diff --git a/modules/bacula/templates/bacula-dir.conf.erb b/modules/bacula/templates/bacula-dir.conf.erb index a10f33aef..62e3f5ce9 100644 --- a/modules/bacula/templates/bacula-dir.conf.erb +++ b/modules/bacula/templates/bacula-dir.conf.erb @@ -123,12 +123,14 @@ Schedule { ######################################################################## Catalog { Name = MyCatalog - dbname = bacula; - dbport = <%= @bacula_db_port %>; - dbaddress = <%= @bacula_db_address %>; + dbname = <%= @db_name %>; + dbport = <%= @db_port %>; + dbaddress = "<%= @db_address %>"; dbsslmode = verify-ca; - dbsslca = /etc/ssl/debian/certs/ca.crt; - dbuser = "bacula"; +<% if @db_sslca %> + dbsslca = "<%= @db_sslca %>; +<% end %> + dbuser = "<%= @db_user %>"; dbpassword = "<%= @bacula_db_secret %>" } -- 2.20.1