diff options
author | Cédric Jeanneret <cedric.jeanneret@camptocamp.com> | 2010-11-08 16:15:43 +0100 |
---|---|---|
committer | Cédric Jeanneret <cedric.jeanneret@camptocamp.com> | 2010-11-15 14:21:11 +0100 |
commit | e0f517634bb58ec8e9f396ff489eb8a9efc73ee0 (patch) | |
tree | be170e0483c52b6bd36a085a957f20ea30975482 /manifests | |
download | puppet-bind-e0f517634bb58ec8e9f396ff489eb8a9efc73ee0.tar.gz puppet-bind-e0f517634bb58ec8e9f396ff489eb8a9efc73ee0.tar.bz2 |
(bind) initial import
Doc will be added later.
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/classes/bind-base.pp | 23 | ||||
-rw-r--r-- | manifests/classes/bind-debian.pp | 5 | ||||
-rw-r--r-- | manifests/classes/bind.pp | 6 | ||||
-rw-r--r-- | manifests/definitions/bind-a.pp | 15 | ||||
-rw-r--r-- | manifests/definitions/bind-aaaa.pp | 16 | ||||
-rw-r--r-- | manifests/definitions/bind-cname.pp | 15 | ||||
-rw-r--r-- | manifests/definitions/bind-mx.pp | 16 | ||||
-rw-r--r-- | manifests/definitions/bind-ns.pp | 15 | ||||
-rw-r--r-- | manifests/definitions/bind-record.pp | 14 | ||||
-rw-r--r-- | manifests/definitions/bind-zone.pp | 58 | ||||
-rw-r--r-- | manifests/init.pp | 2 |
11 files changed, 185 insertions, 0 deletions
diff --git a/manifests/classes/bind-base.pp b/manifests/classes/bind-base.pp new file mode 100644 index 0000000..b31189e --- /dev/null +++ b/manifests/classes/bind-base.pp @@ -0,0 +1,23 @@ +class bind::base { + package {"bind9": + ensure => present, + } + + service {"bind9": + ensure => running, + enable => true, + require => Package["bind9"], + } + + file {["/etc/bind/pri", "/etc/bind/zones"]: + ensure => directory, + owner => root, + group => root, + mode => 0755, + require => Package["bind9"], + purge => true, + force => true, + recurse => true, + source => "puppet:///modules/bind/empty", + } +} diff --git a/manifests/classes/bind-debian.pp b/manifests/classes/bind-debian.pp new file mode 100644 index 0000000..f998a80 --- /dev/null +++ b/manifests/classes/bind-debian.pp @@ -0,0 +1,5 @@ +class bind::debian inherits bind::base { + Service["bind9"] { + pattern => "/usr/sbin/named", + } +} diff --git a/manifests/classes/bind.pp b/manifests/classes/bind.pp new file mode 100644 index 0000000..dcede05 --- /dev/null +++ b/manifests/classes/bind.pp @@ -0,0 +1,6 @@ +class bind { + case $operatingsystem { + "Debian": { include bind::debian } + default: { fail "Unknown $operatingsystem" } + } +} diff --git a/manifests/definitions/bind-a.pp b/manifests/definitions/bind-a.pp new file mode 100644 index 0000000..37153b8 --- /dev/null +++ b/manifests/definitions/bind-a.pp @@ -0,0 +1,15 @@ +define bind::a($ensure=present, + $zone, + $owner, + $host, + $ttl=false) { + + bind::record {$name: + ensure => $ensure, + zone => $zone, + owner => $owner, + host => $host, + ttl => $ttl, + record_type => 'A', + } +} diff --git a/manifests/definitions/bind-aaaa.pp b/manifests/definitions/bind-aaaa.pp new file mode 100644 index 0000000..a20a58c --- /dev/null +++ b/manifests/definitions/bind-aaaa.pp @@ -0,0 +1,16 @@ +define bind::aaaa($ensure=present, + $zone, + $owner, + $host, + $ttl=false) { + + bind::record {$name: + ensure => $ensure, + zone => $zone, + owner => $owner, + host => $host, + ttl => $ttl, + record_type => 'AAAA', + } + +} diff --git a/manifests/definitions/bind-cname.pp b/manifests/definitions/bind-cname.pp new file mode 100644 index 0000000..e166738 --- /dev/null +++ b/manifests/definitions/bind-cname.pp @@ -0,0 +1,15 @@ +define bind::cname($ensure=present, + $zone, + $owner, + $host, + $ttl=false) { + + bind::record {$name: + ensure => $ensure, + zone => $zone, + owner => $owner, + host => $host, + ttl => $ttl, + record_type => 'CNAME', + } +} diff --git a/manifests/definitions/bind-mx.pp b/manifests/definitions/bind-mx.pp new file mode 100644 index 0000000..7eb63d0 --- /dev/null +++ b/manifests/definitions/bind-mx.pp @@ -0,0 +1,16 @@ +define bind::mx($ensure=present, + $zone, + $owner, + $priority, + $host, + $ttl=false) { + + common::concatfilepart{"bind.${name}": + file => "/etc/bind/pri/${zone}", + ensure => $ensure, + notify => Service["bind9"], + content => template("bind/mx-record.erb"), + require => Bind::Zone[$zone], + } +} + diff --git a/manifests/definitions/bind-ns.pp b/manifests/definitions/bind-ns.pp new file mode 100644 index 0000000..9919f53 --- /dev/null +++ b/manifests/definitions/bind-ns.pp @@ -0,0 +1,15 @@ +define bind::ns($ensure=present, + $zone, + $owner, + $host, + $ttl=false) { + + bind::record {$name: + ensure => $ensure, + zone => $zone, + owner => $owner, + host => $host, + ttl => $ttl, + record_type => 'NS', + } +} diff --git a/manifests/definitions/bind-record.pp b/manifests/definitions/bind-record.pp new file mode 100644 index 0000000..5e0cf6f --- /dev/null +++ b/manifests/definitions/bind-record.pp @@ -0,0 +1,14 @@ +define bind::record($ensure=present, + $zone, + $owner, + $host, + $record_type, + $record_class='IN', + $ttl=false) { + + common::concatfilepart {"${zone}.${record_type}.${name}": + ensure => $ensure, + file => "/etc/bind/pri/${zone}.conf", + content => template("bind/default-record.erb"), + } +} diff --git a/manifests/definitions/bind-zone.pp b/manifests/definitions/bind-zone.pp new file mode 100644 index 0000000..137bcd8 --- /dev/null +++ b/manifests/definitions/bind-zone.pp @@ -0,0 +1,58 @@ +define bind::zone($ensure=present, + $is_slave=false, + $zone_ttl=false, + $zone_contact=false, + $zone_serial=false, + $zone_refresh="3h", + $zone_retry="1h", + $zone_expiracy="1w", + $zone_ns=false, + $zone_xfers=false, + $zone_masters=false) { + + common::concatfilepart {"bind.zones.${name}": + ensure => $ensure, + notify => Service["bind9"], + file => "/etc/bind/zones/${name}.conf", + } + + common::concatfilepart {"named.local.zone.${name}": + ensure => $ensure, + notify => Service["bind9"], + file => "/etc/bind/named.conf.local", + content => "include \"/etc/bind/zones/${name}.conf\";\n", + } + + if $is_slave { + if !$zone_masters { + fail "No master defined for ${name}!" + } + Common::Concatfilepart["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}!" + } + + Common::Concatfilepart["bind.zones.${name}"] { + content => template("bind/zone-master.erb"), + } + + common::concatfilepart {"bind.00.${name}": + ensure => $ensure, + file => "/etc/bind/pri/${name}.conf", + content => template("bind/zone-header.erb"), + } + } +} diff --git a/manifests/init.pp b/manifests/init.pp new file mode 100644 index 0000000..6cc1969 --- /dev/null +++ b/manifests/init.pp @@ -0,0 +1,2 @@ +import "classes/*.pp" +import "definitions/*.pp" |