tests: Convert bind configuration file to template
It's better to use a single template file for the bind configuration instead of using a copy for each distribution. The new template file is based on the configuration files from Ubuntu, CentOS and openSUSE. Change-Id: I85ec991d4761db891c624c9495ccc97c7d08dfe3
This commit is contained in:
parent
56fd02a075
commit
92fb2b5284
|
@ -1,29 +0,0 @@
|
|||
options {
|
||||
directory "/var/cache/bind";
|
||||
|
||||
// If there is a firewall between you and nameservers you want
|
||||
// to talk to, you may need to fix the firewall to allow multiple
|
||||
// ports to talk. See http://www.kb.cert.org/vuls/id/800113
|
||||
|
||||
// If your ISP provided one or more IP addresses for stable
|
||||
// nameservers, you probably want to use them as forwarders.
|
||||
// Uncomment the following block, and insert the addresses replacing
|
||||
// the all-0's placeholder.
|
||||
|
||||
// forwarders {
|
||||
// 0.0.0.0;
|
||||
// };
|
||||
|
||||
//========================================================================
|
||||
// If BIND logs error messages about the root key being expired,
|
||||
// you will need to update your keys. See https://www.isc.org/bind-keys
|
||||
//========================================================================
|
||||
dnssec-validation auto;
|
||||
|
||||
auth-nxdomain no; # conform to RFC1035
|
||||
listen-on-v6 { any; };
|
||||
allow-new-zones yes;
|
||||
request-ixfr no;
|
||||
recursion no;
|
||||
};
|
||||
|
|
@ -1,7 +1,21 @@
|
|||
#
|
||||
# {{ ansible_managed }}
|
||||
#
|
||||
options {
|
||||
{% if ansible_pkg_mgr == 'apt' %}
|
||||
directory "/var/cache/bind";
|
||||
{% elif ansible_pkg_mgr == 'yum' %}
|
||||
directory "/var/named";
|
||||
{% elif ansible_pkg_mgr == 'zypper' %}
|
||||
directory "/var/lib/named";
|
||||
managed-keys-directory "/var/lib/named/dyn/";
|
||||
dump-file "/var/log/named_dump.db";
|
||||
statistics-file "/var/log/named.stats";
|
||||
notify no;
|
||||
disable-empty-zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6.ARPA";
|
||||
{% endif %}
|
||||
|
||||
// If there is a firewall between you and any nameservers you want
|
||||
// If there is a firewall between you and nameservers you want
|
||||
// to talk to, you may need to fix the firewall to allow multiple
|
||||
// ports to talk. See http://www.kb.cert.org/vuls/id/800113
|
||||
|
||||
|
@ -27,7 +41,7 @@ options {
|
|||
recursion no;
|
||||
};
|
||||
|
||||
|
||||
{% if ansible_pkg_mgr == 'yum' %}
|
||||
logging {
|
||||
channel default_debug {
|
||||
file "data/named.run";
|
||||
|
@ -49,3 +63,30 @@ controls {
|
|||
include "/etc/named.rfc1912.zones";
|
||||
include "/etc/named.root.key";
|
||||
|
||||
{% elif ansible_pkg_mgr == 'zypper' %}
|
||||
|
||||
zone "." in {
|
||||
type hint;
|
||||
file "root.hint";
|
||||
};
|
||||
|
||||
zone "localhost" in {
|
||||
type master;
|
||||
file "localhost.zone";
|
||||
};
|
||||
|
||||
zone "0.0.127.in-addr.arpa" in {
|
||||
type master;
|
||||
file "127.0.0.zone";
|
||||
};
|
||||
|
||||
zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {
|
||||
type master;
|
||||
file "127.0.0.zone";
|
||||
};
|
||||
|
||||
|
||||
include "/etc/named.conf.include";
|
||||
|
||||
{% endif %}
|
||||
|
|
@ -30,8 +30,8 @@
|
|||
name: "{{ bind_package_name }}"
|
||||
state: present
|
||||
- name: Drop bind configuration
|
||||
copy:
|
||||
src: "{{ named_src_file }}"
|
||||
template:
|
||||
src: "named.conf.j2"
|
||||
dest: "{{ named_config_file }}"
|
||||
- name: fix perms for named directory (centos)
|
||||
file:
|
||||
|
@ -48,7 +48,6 @@
|
|||
state: "{{ bind_service_state }}"
|
||||
vars:
|
||||
named_config_file: "{{ (ansible_pkg_mgr == 'apt') | ternary('/etc/bind/named.conf.options','/etc/named.conf') }}"
|
||||
named_src_file: "{{ (ansible_pkg_mgr == 'apt') | ternary('named.conf.options','named.conf') }}"
|
||||
bind_package_name: "{{ (ansible_pkg_mgr == 'apt') | ternary('bind9','bind') }}"
|
||||
bind_service_name: "{{ (ansible_pkg_mgr == 'apt') | ternary('bind9','named') }}"
|
||||
bind_service_state: "{{ (ansible_pkg_mgr == 'apt') | ternary('restarted','started') }}"
|
||||
|
|
Loading…
Reference in New Issue