diff options
Diffstat (limited to 'manifests/definitions')
-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 |
7 files changed, 149 insertions, 0 deletions
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"), + } + } +} |