diff options
author | Jeanneret Cedric <contact@internux.ch> | 2012-11-14 04:40:25 -0800 |
---|---|---|
committer | Jeanneret Cedric <contact@internux.ch> | 2012-11-14 04:40:25 -0800 |
commit | 84918208b5a32bff8819c7f58fc1f12ec835c3cb (patch) | |
tree | a31d49fa8af41d8463ee07047029cb6e0e7ae34c | |
parent | d8f231f802e967bdf5c30bbee61fab05a7621dc6 (diff) | |
parent | d90ebaf03c69693bf5c2cccd74ea267fca325c6d (diff) | |
download | puppet-bind-84918208b5a32bff8819c7f58fc1f12ec835c3cb.tar.gz puppet-bind-84918208b5a32bff8819c7f58fc1f12ec835c3cb.tar.bz2 |
Merge pull request #7 from cjeanneret/correct-zone-removal
corrected how bind module removes a zone
-rw-r--r-- | manifests/zone.pp | 124 |
1 files changed, 68 insertions, 56 deletions
diff --git a/manifests/zone.pp b/manifests/zone.pp index eb07746..d7fbc40 100644 --- a/manifests/zone.pp +++ b/manifests/zone.pp @@ -30,25 +30,6 @@ define bind::zone ( $zone_origin = false ) { - concat {"/etc/bind/pri/${name}.conf": - owner => root, - group => root, - mode => '0644', - } - - concat {"/etc/bind/zones/${name}.conf": - owner => root, - group => root, - mode => '0644', - } - - concat::fragment {"bind.zones.${name}": - ensure => $ensure, - target => "/etc/bind/zones/${name}.conf", - notify => Service['bind9'], - require => Package['bind9'], - } - concat::fragment {"named.local.zone.${name}": ensure => $ensure, target => '/etc/bind/named.conf.local', @@ -57,47 +38,78 @@ define bind::zone ( require => Package['bind9'], } - if $is_slave { - if !$zone_masters { - fail "No master defined for ${name}!" - } - Concat::Fragment["bind.zones.${name}"] { - content => template('bind/zone-slave.erb'), - } + case $ensure { + present: { + concat {"/etc/bind/pri/${name}.conf": + owner => root, + group => root, + mode => '0644', + } + + concat {"/etc/bind/zones/${name}.conf": + owner => root, + group => root, + mode => '0644', + } + concat::fragment {"bind.zones.${name}": + ensure => $ensure, + target => "/etc/bind/zones/${name}.conf", + notify => Service['bind9'], + require => Package['bind9'], + } + + + if $is_slave { + if !$zone_masters { + fail "No master defined for ${name}!" + } + Concat::Fragment["bind.zones.${name}"] { + content => template('bind/zone-slave.erb'), + } ## END of slave - } else { - if !$zone_contact { - fail "No contact defined for ${name}!" - } - if !$zone_ns { - fail "No ns defined for ${name}!" - } - if !$zone_serial { - fail "No serial defined for ${name}!" - } - if !$zone_ttl { - fail "No ttl defined for ${name}!" - } + } else { + if !$zone_contact { + fail "No contact defined for ${name}!" + } + if !$zone_ns { + fail "No ns defined for ${name}!" + } + if !$zone_serial { + fail "No serial defined for ${name}!" + } + if !$zone_ttl { + fail "No ttl defined for ${name}!" + } - Concat::Fragment["bind.zones.${name}"] { - content => template('bind/zone-master.erb'), - } + Concat::Fragment["bind.zones.${name}"] { + content => template('bind/zone-master.erb'), + } - concat::fragment {"00.bind.${name}": - ensure => $ensure, - target => "/etc/bind/pri/${name}.conf", - content => template('bind/zone-header.erb'), - require => Package['bind9'], - } + concat::fragment {"00.bind.${name}": + ensure => $ensure, + target => "/etc/bind/pri/${name}.conf", + content => template('bind/zone-header.erb'), + require => Package['bind9'], + } - file {"/etc/bind/pri/${name}.conf.d": - ensure => absent, - mode => '0700', - purge => true, - recurse => true, - backup => false, - force => true, + file {"/etc/bind/pri/${name}.conf.d": + ensure => absent, + mode => '0700', + purge => true, + recurse => true, + backup => false, + force => true, + } + } } + absent: { + file {"/etc/bind/pri/${name}.conf": + ensure => absent, + } + file {"/etc/bind/zones/${name}.conf": + ensure => absent, + } + } + default: {} } - } |