summaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
authorCédric Jeanneret <cedric.jeanneret@camptocamp.com>2012-11-09 15:24:08 +0100
committerCédric Jeanneret <cedric.jeanneret@camptocamp.com>2012-11-09 15:24:08 +0100
commitd90ebaf03c69693bf5c2cccd74ea267fca325c6d (patch)
treea31d49fa8af41d8463ee07047029cb6e0e7ae34c /manifests
parentd8f231f802e967bdf5c30bbee61fab05a7621dc6 (diff)
downloadpuppet-bind-d90ebaf03c69693bf5c2cccd74ea267fca325c6d.tar.gz
puppet-bind-d90ebaf03c69693bf5c2cccd74ea267fca325c6d.tar.bz2
corrected how bind modules removes a zone
Diffstat (limited to 'manifests')
-rw-r--r--manifests/zone.pp124
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: {}
}
-
}