]> git.donarmstrong.com Git - dsa-puppet.git/commitdiff
some cleanup of bacula classes
authorStephen Gran <steve@lobefin.net>
Sun, 24 Jun 2012 12:11:05 +0000 (13:11 +0100)
committerStephen Gran <steve@lobefin.net>
Sun, 24 Jun 2012 12:11:05 +0000 (13:11 +0100)
Signed-off-by: Stephen Gran <steve@lobefin.net>
manifests/site.pp
modules/bacula/manifests/client.pp
modules/bacula/manifests/director.pp
modules/bacula/manifests/init.pp
modules/bacula/manifests/node.pp [new file with mode: 0644]
modules/bacula/manifests/storage.pp

index f75f0f87943468e91863492fbaee6ea67825d921..a504ecbc1b84cc32eb1c9e7a0e45e47da4a51c09 100644 (file)
@@ -46,6 +46,7 @@ node default {
 
        if $::hostname in [berlioz, biber, draghi] {
                include bacula::client
+               @@bacula::node { $::fqdn: }
        }
 
        if $::hostname == 'beethoven' {
index f9f113298a3b2521be6cca3622a535968b8e7964..8fbfb0d3e3e653132d86cbef56629af62d2e177a 100644 (file)
@@ -1,44 +1,34 @@
 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",
+       }
 }
index 58c143d2d36adcd0c7a7f7caf084bc69be23a40d..6540c4d44debad9b5954ef58b422e5d1f9ef6a74 100644 (file)
@@ -1,64 +1,35 @@
 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",
+       }
 }
index 88448fc32a1cb290f6b0c401e1b042f479b05ed2..d57280de0d22831c9edc98f39318136c95bc4dba 100644 (file)
@@ -1 +1,39 @@
-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']
+       }
+}
diff --git a/modules/bacula/manifests/node.pp b/modules/bacula/manifests/node.pp
new file mode 100644 (file)
index 0000000..7f59414
--- /dev/null
@@ -0,0 +1,15 @@
+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']
+       }
+}
+
index f0a09df7a84b509b8a693e0df1e123ed476cf773..e6738672d67f902a6d4798539fb3bbb0498bf00b 100644 (file)
@@ -1,42 +1,32 @@
 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,
+       }
 }