From c4bc2a1c4a8a23168ca17900319dedfee442d677 Mon Sep 17 00:00:00 2001 From: Nate Riffe Date: Sun, 15 Jun 2014 10:08:55 -0500 Subject: [PATCH] Add modelines and reformat pp files --- manifests/acl.pp | 14 ++-- manifests/init.pp | 170 ++++++++++++++++++++++---------------------- manifests/key.pp | 41 ++++++----- manifests/params.pp | 58 +++++++-------- manifests/view.pp | 26 +++---- manifests/zone.pp | 138 +++++++++++++++++------------------ 6 files changed, 231 insertions(+), 216 deletions(-) diff --git a/manifests/acl.pp b/manifests/acl.pp index 43cd876..f493e14 100644 --- a/manifests/acl.pp +++ b/manifests/acl.pp @@ -1,11 +1,13 @@ +# ex: syntax=puppet si ts=4 sw=4 et + define bind::acl ( - $addresses, + $addresses, ) { - concat::fragment { "bind-acl-${name}": - order => '10', - target => "${bind::params::confdir}/acls.conf", - content => template('bind/acl.erb'), - } + concat::fragment { "bind-acl-${name}": + order => '10', + target => "${bind::params::confdir}/acls.conf", + content => template('bind/acl.erb'), + } } diff --git a/manifests/init.pp b/manifests/init.pp index 6577c59..c99cae1 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,100 +1,102 @@ +# ex: syntax=puppet si ts=4 sw=4 et + class bind ( - $confdir = $bind::params::confdir, - $cachedir = $bind::params::cachedir, - $forwarders = '', - $dnssec = true, - $version = '', + $confdir = $bind::params::confdir, + $cachedir = $bind::params::cachedir, + $forwarders = '', + $dnssec = true, + $version = '', ) inherits bind::params { - $auth_nxdomain = false + $auth_nxdomain = false - package { $bind::params::bind_package: - ensure => latest, - } + package { $bind::params::bind_package: + ensure => latest, + } - if $dnssec { - file { '/usr/local/bin/dnssec-init': - ensure => present, - owner => 'root', - group => 'root', - mode => '0755', - source => 'puppet:///modules/bind/dnssec-init', - } - } + if $dnssec { + file { '/usr/local/bin/dnssec-init': + ensure => present, + owner => 'root', + group => 'root', + mode => '0755', + source => 'puppet:///modules/bind/dnssec-init', + } + } - service { $bind::params::bind_service: - ensure => running, - enable => true, - hasrestart => true, - hasstatus => true, - require => Package[$bind::params::bind_package], - } + service { $bind::params::bind_service: + ensure => running, + enable => true, + hasrestart => true, + hasstatus => true, + require => Package[$bind::params::bind_package], + } - File { - ensure => present, - owner => 'root', - group => $::bind::params::bind_group, - mode => 0644, - } - - file { [ $confdir, "${confdir}/zones" ]: - ensure => directory, - mode => 2755, - purge => true, - recurse => true, - require => Package[$bind::params::bind_package], - } + File { + ensure => present, + owner => 'root', + group => $::bind::params::bind_group, + mode => 0644, + } + + file { [ $confdir, "${confdir}/zones" ]: + ensure => directory, + mode => 2755, + purge => true, + recurse => true, + require => Package[$bind::params::bind_package], + } - file { "${confdir}/named.conf": - content => template('bind/named.conf.erb'), - notify => Service[$bind::params::bind_service], - require => Package[$bind::params::bind_package], - } + file { "${confdir}/named.conf": + content => template('bind/named.conf.erb'), + notify => Service[$bind::params::bind_service], + require => Package[$bind::params::bind_package], + } - file { "${confdir}/keys": - ensure => directory, - mode => 0755, - require => Package[$bind::params::bind_package], - } + file { "${confdir}/keys": + ensure => directory, + mode => 0755, + require => Package[$bind::params::bind_package], + } - file { "${confdir}/named.conf.local": - replace => false, - require => Package[$bind::params::bind_package], - } + file { "${confdir}/named.conf.local": + replace => false, + require => Package[$bind::params::bind_package], + } - concat { [ - "${confdir}/acls.conf", - "${confdir}/keys.conf", - "${confdir}/views.conf", - ]: - owner => 'root', - group => $bind::params::bind_group, - mode => '0644', - notify => Service[$bind::params::bind_service], - require => Package[$bind::params::bind_package], - } + concat { [ + "${confdir}/acls.conf", + "${confdir}/keys.conf", + "${confdir}/views.conf", + ]: + owner => 'root', + group => $bind::params::bind_group, + mode => '0644', + notify => Service[$bind::params::bind_service], + require => Package[$bind::params::bind_package], + } - concat::fragment { "named-acls-header": - order => '00', - target => "${confdir}/acls.conf", - content => "# This file is managed by puppet - changes will be lost\n", - } + concat::fragment { "named-acls-header": + order => '00', + target => "${confdir}/acls.conf", + content => "# This file is managed by puppet - changes will be lost\n", + } - concat::fragment { "named-keys-header": - order => '00', - target => "${confdir}/keys.conf", - content => "# This file is managed by puppet - changes will be lost\n", - } + concat::fragment { "named-keys-header": + order => '00', + target => "${confdir}/keys.conf", + content => "# This file is managed by puppet - changes will be lost\n", + } - concat::fragment { "named-keys-rndc": - order => '99', - target => "${confdir}/keys.conf", - content => "#include \"${confdir}/rndc.key\"\n", - } + concat::fragment { "named-keys-rndc": + order => '99', + target => "${confdir}/keys.conf", + content => "#include \"${confdir}/rndc.key\"\n", + } - concat::fragment { "named-views-header": - order => '00', - target => "${confdir}/views.conf", - content => "# This file is managed by puppet - changes will be lost\n", - } + concat::fragment { "named-views-header": + order => '00', + target => "${confdir}/views.conf", + content => "# This file is managed by puppet - changes will be lost\n", + } } diff --git a/manifests/key.pp b/manifests/key.pp index 7f919f5..bf0ee9b 100644 --- a/manifests/key.pp +++ b/manifests/key.pp @@ -1,21 +1,26 @@ +# ex: syntax=puppet si ts=4 sw=4 et + define bind::key ( - $algorithm = 'hmac-sha256', - $secret, - $owner = 'root', - $group = $bind::params::bind_group, + $algorithm = 'hmac-sha256', + $secret, + $owner = 'root', + $group = $bind::params::bind_group, + path = "${::bind::confdir}/keys" ) { - file { "${bind::confdir}/keys/${name}": - ensure => present, - owner => $owner, - group => $group, - mode => '0640', - content => template('bind/key.conf.erb'), - notify => Service[$bind::params::bind_service], - require => Package[$bind::params::bind_package], - } - concat::fragment { "bind-key-${name}": - order => '10', - target => "${bind::confdir}/keys.conf", - content => "include \"${bind::confdir}/keys/${name}\";\n", - } + file { "${path}/${name}": + ensure => present, + owner => $owner, + group => $group, + mode => '0640', + content => template('bind/key.conf.erb'), + notify => Service[$bind::params::bind_service], + require => Package[$bind::params::bind_package], + } + if (defined(Class['bind'])) { + concat::fragment { "bind-key-${name}": + order => '10', + target => "${bind::confdir}/keys.conf", + content => "include \"${bind::confdir}/keys/${name}\";\n", + } + } } diff --git a/manifests/params.pp b/manifests/params.pp index e646b7f..04db6a7 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -1,33 +1,35 @@ +# ex: syntax=puppet si ts=4 sw=4 et + class bind::params { - case $::osfamily { - 'Debian': { - $bind_package = 'bind9' - $bind_service = 'bind9' - $confdir = '/etc/bind' - $cachedir = '/var/cache/bind' - $bind_user = 'bind' - $bind_group = 'bind' + case $::osfamily { + 'Debian': { + $bind_package = 'bind9' + $bind_service = 'bind9' + $confdir = '/etc/bind' + $cachedir = '/var/cache/bind' + $bind_user = 'bind' + $bind_group = 'bind' - file { [ - "${confdir}/bind.keys", - "${confdir}/db.empty", - "${confdir}/db.local", - "${confdir}/db.root", - "${confdir}/db.0", - "${confdir}/db.127", - "${confdir}/db.255", - "${confdir}/named.conf.default-zones", - "${confdir}/rndc.key", - "${confdir}/zones.rfc1918", - ]: - ensure => present, - require => Package[$bind_package], - } - } - default: { - fail("Operating system is not supported ${::osfamily}") - } - } + file { [ + "${confdir}/bind.keys", + "${confdir}/db.empty", + "${confdir}/db.local", + "${confdir}/db.root", + "${confdir}/db.0", + "${confdir}/db.127", + "${confdir}/db.255", + "${confdir}/named.conf.default-zones", + "${confdir}/rndc.key", + "${confdir}/zones.rfc1918", + ]: + ensure => present, + require => Package[$bind_package], + } + } + default: { + fail("Operating system is not supported ${::osfamily}") + } + } } diff --git a/manifests/view.pp b/manifests/view.pp index 7533c73..f5717ad 100644 --- a/manifests/view.pp +++ b/manifests/view.pp @@ -1,14 +1,16 @@ -define bind::view ( - $match_clients = 'any', - $match_destinations = '', - $zones = [], - $recursion = true, -) { - $confdir = $bind::params::confdir +# ex: syntax=puppet si ts=4 sw=4 et - concat::fragment { "bind-view-${name}": - order => '10', - target => "${bind::params::confdir}/views.conf", - content => template('bind/view.erb'), - } +define bind::view ( + $match_clients = 'any', + $match_destinations = '', + $zones = [], + $recursion = true, +) { + $confdir = $bind::params::confdir + + concat::fragment { "bind-view-${name}": + order => '10', + target => "${bind::params::confdir}/views.conf", + content => template('bind/view.erb'), + } } diff --git a/manifests/zone.pp b/manifests/zone.pp index 5c20f1a..c842096 100644 --- a/manifests/zone.pp +++ b/manifests/zone.pp @@ -1,79 +1,81 @@ +# ex: syntax=puppet si ts=4 sw=4 et + define bind::zone ( - $zone_type, - $domain = '', - $masters = '', - $allow_updates = '', - $allow_transfers = '', - $dnssec = false, - $key_directory = '', - $ns_notify = true, - $also_notify = '', - $allow_notify = '', - $forwarders = '', - $forward = '', + $zone_type, + $domain = '', + $masters = '', + $allow_updates = '', + $allow_transfers = '', + $dnssec = false, + $key_directory = '', + $ns_notify = true, + $also_notify = '', + $allow_notify = '', + $forwarders = '', + $forward = '', ) { - $cachedir = $bind::cachedir + $cachedir = $bind::cachedir - if $domain == '' { - $_domain = $name - } else { - $_domain = $domain - } + if $domain == '' { + $_domain = $name + } else { + $_domain = $domain + } - $has_zone_file = $zone_type ? { - 'master' => true, - 'slave' => true, - 'hint' => true, - 'stub' => true, - default => false, - } + $has_zone_file = $zone_type ? { + 'master' => true, + 'slave' => true, + 'hint' => true, + 'stub' => true, + default => false, + } - if $has_zone_file { - file { "${cachedir}/${name}": - ensure => directory, - owner => $bind::params::bind_user, - group => $bind::params::bind_group, - mode => '0755', - require => Package[$bind::params::bind_package], - } + if $has_zone_file { + file { "${cachedir}/${name}": + ensure => directory, + owner => $bind::params::bind_user, + group => $bind::params::bind_group, + mode => '0755', + require => Package[$bind::params::bind_package], + } - file { "${cachedir}/${name}/${_domain}": - ensure => present, - owner => $bind::params::bind_user, - group => $bind::params::bind_group, - mode => '0644', - replace => false, - source => 'puppet:///modules/bind/db.empty', - audit => [ content ], - } + file { "${cachedir}/${name}/${_domain}": + ensure => present, + owner => $bind::params::bind_user, + group => $bind::params::bind_group, + mode => '0644', + replace => false, + source => 'puppet:///modules/bind/db.empty', + audit => [ content ], + } - if $dnssec { - exec { "dnssec-keygen-${name}": - command => "/usr/local/bin/dnssec-init '${cachedir}' '${name}' '${_domain}' '${key_directory}'", - cwd => $cachedir, - user => $bind::params::bind_user, - creates => "${cachedir}/${name}/${_domain}.signed", - timeout => 0, # crypto is hard - require => [ File['/usr/local/bin/dnssec-init'], File["${cachedir}/${name}/${_domain}"] ], - } + if $dnssec { + exec { "dnssec-keygen-${name}": + command => "/usr/local/bin/dnssec-init '${cachedir}' '${name}' '${_domain}' '${key_directory}'", + cwd => $cachedir, + user => $bind::params::bind_user, + creates => "${cachedir}/${name}/${_domain}.signed", + timeout => 0, # crypto is hard + require => [ File['/usr/local/bin/dnssec-init'], File["${cachedir}/${name}/${_domain}"] ], + } - file { "${cachedir}/${name}/${_domain}.signed": - owner => $bind::params::bind_user, - group => $bind::params::bind_group, - mode => '0644', - audit => [ content ], - } - } - } + file { "${cachedir}/${name}/${_domain}.signed": + owner => $bind::params::bind_user, + group => $bind::params::bind_group, + mode => '0644', + audit => [ content ], + } + } + } - file { "${bind::confdir}/zones/${name}.conf": - ensure => present, - owner => 'root', - group => $bind::params::bind_group, - mode => '0644', - content => template('bind/zone.conf.erb'), - notify => Service[$bind::params::bind_service], - require => Package[$bind::params::bind_package], - } + file { "${bind::confdir}/zones/${name}.conf": + ensure => present, + owner => 'root', + group => $bind::params::bind_group, + mode => '0644', + content => template('bind/zone.conf.erb'), + notify => Service[$bind::params::bind_service], + require => Package[$bind::params::bind_package], + } }