Reduce template abstraction and add documentation

Modify the handling of the `servers` property in `bind::view` to respond to
specific keys in the config hash for each server, and document how this
property is handled.
This commit is contained in:
Nate Riffe 2015-09-23 07:18:23 -05:00
parent 8005dfa7d9
commit 2f2e971efd
2 changed files with 32 additions and 7 deletions

View File

@ -227,6 +227,30 @@ and queries for the `example.org` domain are handled using a declared zone (see
], ],
} }
View declarations can also include server clause configuration. The `servers`
property of `bind::view` accepts an array value which specifies each `server`
clause in the view as a hash. The hash must contain an `ip_addr` key which
specifies the IP address (optionally, a CIDR address range), and may contain a
`keys` key with a string value. The value of `keys` will be used as the name of
a key in the `server` clause. In this example, the `ns` view will contain a
`server` clause that configures BIND to use the key `internal-ns` to TSIG-sign
transactions with `192.168.24.2` and the key `hurricane-electric` to TSIG-sign
transactions with `216.218.130.2`:
bind::view { 'ns':
servers => [
{
'ip_addr' => '192.168.24.2',
'keys' => 'internal-ns',
},
{
'ip_addr' => '216.218.130.2',
'keys' => 'hurricane-electric',
}
],
...
}
###resource_record ###resource_record
Declares a resource record. For exampmle: Declares a resource record. For exampmle:

View File

@ -34,14 +34,15 @@ view "<%= @name %>" {
}; };
<%- end -%> <%- end -%>
<%- end -%> <%- end -%>
<%- if @server -%> <%- if @servers and @servers.is_a?(Array) -%>
<%- @server.each_pair do |srv, srv_values| -%> <%- @servers.each do |properties| -%>
server <%= srv %> { <%- raise Puppet::Error, 'view servers must have an ip_addr key' unless properties.has_key?('ip_addr') -%>
<%- Array(srv_values).each do |srv_value| -%> server <%= properties['ip_addr'] %> {
<%= srv_value %>; <%- if properties.has_key?('keys') and properties['keys'] != '' -%>
<%- end -%> keys { <%= properties['keys'] %>; };
<%- end -%>
}; };
<%- end -%> <%- end -%>
<%- end -%> <%- end -%>
<%- if scope.lookupvar('osfamily') == 'Debian' -%> <%- if scope.lookupvar('osfamily') == 'Debian' -%>
include "<%= @confdir %>/named.conf.default-zones"; include "<%= @confdir %>/named.conf.default-zones";