diff --git a/README.md b/README.md index bede482..c10555e 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ This role can work on Debian derived OS, but it's not our priority. ## Role variables * `bind_role` - the role `master` or `slave`, don't generate dnssec key on `slave` +* `bind_options` - hash general bind options * `bind_zones` - the dns zones * `bind_listen_ipv4` - enable or disable ip v4 support (default: true) * `bind_listen_ipv6` - enable or disable ip v6 support (default: true) @@ -40,6 +41,8 @@ This role can work on Debian derived OS, but it's not our priority. ``` bind_listen_ipv6: true bind_listen_ipv4: true +bind_options: + server-id: '"1"' bind_zones: test.local: @@ -47,6 +50,10 @@ bind_zones: mail: root@test.local serial: 2017092202 dnssec: yes + options: + key-directory: '"/etc/bind/keys"' + auto-dnssec: maintain + inline-signing: yes records: - { name: '@', type: ns, value: localhost. } - { name: hello, type: a, ttl: 5m, value: 1.2.3.4 } @@ -56,10 +63,6 @@ bind_zones: mail: root@hello.local serial: 2017092201 dnssec: no - options: - key-directory: '"/etc/bind/keys"' - auto-dnssec: maintain - inline-signing: yes records: - { name: '@', type: ns, value: localhost. } - { name: hello, type: a, value: 4.3.2.1 } diff --git a/defaults/main.yml b/defaults/main.yml index e8dbf6b..f2512ea 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,3 +1,5 @@ --- +bind_role: master bind_listen_ipv4: true bind_listen_ipv6: true +bind_options: {} diff --git a/templates/named.conf.options.j2 b/templates/named.conf.options.j2 index b33733b..013701f 100644 --- a/templates/named.conf.options.j2 +++ b/templates/named.conf.options.j2 @@ -11,5 +11,9 @@ options { listen-on { {% if bind_listen_ipv4 %}any{% else %}none{% endif %}; }; listen-on-v6 { {% if bind_listen_ipv6 %}any{% else %}none{% endif %}; }; +{% for option, value in bind_options.iteritems() %} + {{ option }} {% if value == True %}yes{% elif value == False %}no{% else %}{{ value }}{% endif %}; +{% endfor %} + version none; }; diff --git a/test/integration/bind/default.yml b/test/integration/bind/default.yml index 0cfcb0a..6b58ea3 100644 --- a/test/integration/bind/default.yml +++ b/test/integration/bind/default.yml @@ -3,6 +3,8 @@ vars: bind_listen_ipv6: false bind_role: master + bind_options: + server-id: '"1"' bind_zones: test.local: allow_transfer: diff --git a/test/integration/bind/serverspec/bind_spec.rb b/test/integration/bind/serverspec/bind_spec.rb index a7a20d1..4c37eb1 100644 --- a/test/integration/bind/serverspec/bind_spec.rb +++ b/test/integration/bind/serverspec/bind_spec.rb @@ -45,6 +45,7 @@ describe file('/etc/bind/named.conf.options') do it { should be_grouped_into 'root' } it { should contain 'listen-on { any; };' } it { should contain 'listen-on-v6 { none; };' } + it { should contain 'server-id "1";' } end describe service('bind9') do