if $::hostname in [berlioz, biber, draghi] {
include bacula::client
+ @@bacula::node { $::fqdn: }
}
if $::hostname == 'beethoven' {
class bacula::client inherits bacula {
- package {
- "bacula-client": ensure => installed;
- "bacula-fd": ensure => installed;
- }
+ package { ['bacula-client', 'bacula-fd']:
+ ensure => installed
+ }
- service {
- "bacula-fd":
- ensure => running,
- enable => true,
- hasstatus => true,
- require => Package["bacula-fd"];
- }
+ service { 'bacula-fd':
+ ensure => running,
+ enable => true,
+ hasstatus => true,
+ require => Package['bacula-fd']
+ }
- file {
- "/etc/bacula/bacula-fd.conf":
- content => template("bacula/bacula-fd.conf.erb"),
- mode => 640,
- owner => root,
- group => bacula,
- require => Package["bacula-fd"],
- notify => Exec["bacula-fd restart"]
- ;
- }
+ file { '/etc/bacula/bacula-fd.conf':
+ content => template('bacula/bacula-fd.conf.erb'),
+ mode => '0640',
+ owner => root,
+ group => bacula,
+ require => Package['bacula-fd'],
+ notify => Service['bacula-fd']
+ }
- exec {
- "bacula-fd restart":
- path => "/etc/init.d:/usr/bin:/usr/sbin:/bin:/sbin",
- refreshonly => true;
- }
+ @ferm::rule { 'dsa-bacula-fd-v4':
+ domain => '(ip)',
+ description => 'Allow bacula access from storage and director',
+ rule => "proto tcp mod state state (NEW) dport (bacula-fd) saddr (${bacula_director_address}) ACCEPT",
+ }
- @ferm::rule { 'dsa-bacula-fd-v4':
- domain => '(ip)',
- description => 'Allow bacula access from storage and director',
- rule => "proto tcp mod state state (NEW) dport (bacula-fd) saddr (${bacula_director_address}) ACCEPT",
- }
-
- @ferm::rule { 'dsa-bacula-fd-v6':
- domain => '(ip6)',
- description => 'Allow bacula access from storage and director',
- rule => "proto tcp mod state state (NEW) dport (bacula-fd) saddr (${bacula_director_address}) ACCEPT",
- }
+ @ferm::rule { 'dsa-bacula-fd-v6':
+ domain => '(ip6)',
+ description => 'Allow bacula access from storage and director',
+ rule => "proto tcp mod state state (NEW) dport (bacula-fd) saddr (${bacula_director_address}) ACCEPT",
+ }
}
class bacula::director inherits bacula {
- package {
- "bacula-director-pgsql": ensure => installed;
- "bacula-common": ensure => installed;
- "bacula-common-pgsql": ensure => installed;
- }
+ package { ['bacula-director-pgsql', 'bacula-common', 'bacula-common-pgsql']:
+ ensure => installed
+ }
- service {
- "bacula-director":
- ensure => running,
- enable => true,
- hasstatus => true,
- require => Package["bacula-director-pgsql"];
- }
- file {
- "/etc/bacula/conf.d":
- ensure => directory,
- mode => 755,
- group => bacula,
- purge => true,
- notify => Exec["bacula-director restart"]
- ;
- "/etc/bacula/bacula-dir.conf":
- content => template("bacula/bacula-dir.conf.erb"),
- mode => 440,
- group => bacula,
- require => Package["bacula-director-pgsql"],
- notify => Exec["bacula-director restart"]
- ;
- }
+ service { 'bacula-director':
+ ensure => running,
+ enable => true,
+ hasstatus => true,
+ require => Package['bacula-director-pgsql']
+ }
- exec {
- "bacula-director restart":
- path => "/etc/init.d:/usr/bin:/usr/sbin:/bin:/sbin",
- refreshonly => true;
- }
+ file { '/etc/bacula/conf.d':
+ ensure => directory,
+ mode => '0755',
+ group => bacula,
+ purge => true,
+ notify => Service['bacula-director']
+ }
- define bacula_client() {
- # These must be kept in sync with the settings in bacula.pp
- $bacula_client_name = "${name}-fd"
- $bacula_client_secret = hmac("/etc/puppet/secret", "bacula-fd-${name}")
- $client = $name
-
- file {
- "/etc/bacula/conf.d/${name}.conf":
- content => template("bacula/per-client.conf.erb"),
- mode => 440,
- group => bacula,
- notify => Exec["bacula-director restart"]
- ;
- }
- }
-# $allhosts = keys($site::allnodeinfo)
- $allhosts = [ "berlioz.debian.org", "biber.debian.org", "draghi.debian.org" ]
- bacula_client { $allhosts: }
-
- @ferm::rule { 'dsa-bacula-dir':
- domain => '(ip ip6)',
- description => 'Allow bacula access from localhost',
- rule => "proto tcp mod state state (NEW) dport (bacula-dir) saddr (${bacula_director_address} localhost) ACCEPT",
- }
+ file { '/etc/bacula/bacula-dir.conf':
+ content => template('bacula/bacula-dir.conf.erb'),
+ mode => '0440',
+ group => bacula,
+ require => Package['bacula-director-pgsql'],
+ notify => Service['bacula-director']
+ }
+ @ferm::rule { 'dsa-bacula-dir':
+ domain => '(ip ip6)',
+ description => 'Allow bacula access from localhost',
+ rule => "proto tcp mod state state (NEW) dport (bacula-dir) saddr (${bacula_director_address} localhost) ACCEPT",
+ }
}
-class bacula {}
+class bacula {
+
+ $bacula_operator_email = 'debian-admin@debian.org'
+
+ $bacula_director_name = 'debian-dir'
+ $bacula_storage_name = 'debian-sd'
+ $bacula_client_name = "${::fqdn}-fd"
+ $bacula_monitor_name = 'debian-mon'
+ $bacula_filestor_name = 'File'
+ $bacula_filestor_device = 'FileStorage'
+ $bacula_pool_name = 'debian'
+
+ $bacula_director_address = 'dinis.debian.org'
+ $bacula_director_port = 9101
+ $bacula_storage_address = 'beethoven.debian.org'
+ $bacula_storage_port = 9103
+ $bacula_client_port = 9102
+ $bacula_db_address = 'danzi.debian.org'
+ $bacula_db_port = 5433
+
+ $bacula_backup_path = '/srv/bacula'
+
+ $bacula_director_secret = hmac('/etc/puppet/secret', "bacula-dir-${::hostname}")
+ $bacula_db_secret = hmac('/etc/puppet/secret', "bacula-db-${::hostname}")
+ $bacula_storage_secret = hmac('/etc/puppet/secret', "bacula-sd-${bacula_storage_name}")
+ $bacula_client_secret = hmac('/etc/puppet/secret', "bacula-fd-${::fqdn}")
+ $bacula_monitor_secret = hmac('/etc/puppet/secret', "bacula-monitor-${bacula_director_name}")
+
+ package { 'bacula-console':
+ ensure => installed;
+ }
+
+ file { '/etc/bacula/bconsole.conf':
+ content => template('bacula/bconsole.conf.erb'),
+ mode => '0640',
+ group => bacula,
+ require => Package['bacula-console']
+ }
+}
--- /dev/null
+define bacula::node() {
+ include bacula::director
+
+ $bacula_client_name = "${name}-fd"
+ $bacula_client_secret = hmac('/etc/puppet/secret', "bacula-fd-${name}")
+ $client = $name
+
+ file { "/etc/bacula/conf.d/${name}.conf":
+ content => template('bacula/per-client.conf.erb'),
+ mode => '0440',
+ group => bacula,
+ notify => Service['bacula-director']
+ }
+}
+
class bacula::storage inherits bacula {
- package {
- "bacula-sd": ensure => installed;
- }
+ package { 'bacula-sd':
+ ensure => installed
+ }
- service {
- "bacula-sd":
- ensure => running,
- enable => true,
- hasstatus => true,
- ;
- }
- file {
- "/etc/bacula/bacula-sd.conf":
- content => template("bacula/bacula-sd.conf.erb"),
- mode => 640,
- group => bacula,
- notify => Exec["bacula-sd restart"]
- ;
- }
+ service { 'bacula-sd':
+ ensure => running,
+ enable => true,
+ hasstatus => true,
+ }
+ file { '/etc/bacula/bacula-sd.conf':
+ content => template('bacula/bacula-sd.conf.erb'),
+ mode => '0640',
+ group => bacula,
+ notify => Service['bacula-sd']
+ }
- exec {
- "bacula-sd restart":
- path => "/etc/init.d:/usr/bin:/usr/sbin:/bin:/sbin",
- refreshonly => true;
- }
+ @ferm::rule { 'dsa-bacula-sd-v4':
+ domain => '(ip)',
+ description => 'Allow bacula-sd access from director and clients',
+ rule => 'proto tcp mod state state (NEW) dport (bacula-sd) @subchain \'bacula-sd\' { saddr ($HOST_DEBIAN_V4) ACCEPT; }',
+ notarule => true,
+ }
- @ferm::rule { 'dsa-bacula-sd-v4':
- domain => '(ip)',
- description => 'Allow bacula-sd access from director and clients',
- rule => 'proto tcp mod state state (NEW) dport (bacula-sd) @subchain \'bacula-sd\' { saddr ($HOST_DEBIAN_V4) ACCEPT; }',
- notarule => true,
- }
-
- @ferm::rule { 'dsa-bacula-sd-v6':
- domain => '(ip6)',
- description => 'Allow bacula-sd access from director and clients',
- rule => 'proto tcp mod state state (NEW) dport (bacula-sd) @subchain \'bacula-sd\' { saddr ($HOST_DEBIAN_V6) ACCEPT; }',
- notarule => true,
- }
+ @ferm::rule { 'dsa-bacula-sd-v6':
+ domain => '(ip6)',
+ description => 'Allow bacula-sd access from director and clients',
+ rule => 'proto tcp mod state state (NEW) dport (bacula-sd) @subchain \'bacula-sd\' { saddr ($HOST_DEBIAN_V6) ACCEPT; }',
+ notarule => true,
+ }
}