tenhishadow.manage_bind

tenhishadow.manage_bind

========= Build Status

This tool automatically configures BIND on managed servers. It checks the configuration and zones before restarting.

During setup, Ansible will:

  • Install and set up firewalld (unless the default variable "firewalld" is changed)
  • Install BIND in a chroot environment
  • Configure named and its zones, checking for syntax errors with named-checkconf and named-checkzone
  • Restart the BIND service if everything is successful

Requirements


Example Playbook


---

- hosts: external_dns
  become: "yes"
  become_user: "root"
  gather_facts: "true"
  any_errors_fatal: "true"
  serial: "1" 			# Handles one server at a time to avoid failures on all BIND servers
  vars:
    - configs: configs
  vars_files:
    - configs/ansible_vars.yml
  roles:
  - tenhishadow.manage_bind

...

Example Files for Playbook


.
├── configs
│   ├── ansible_vars.yml	# Contains variables for the playbook including zones and parameters
│   ├── example.com.zone	# Zone file with DNS records
│   ├── example1.com.zone	# Additional zone file with DNS records
│   ├── named.j2		# Main configuration file, saved as /etc/named.conf 
└── playbook.yml

Example Content for ansible_vars.yml:


---

zones:
  example.com:
    file: "example.com.zone"
    zone_serial: '2018052901'
    zone_refresh: '3600'
    zone_retry: '7200'
    zone_expire: '3600000'
    zone_minimum: '3600'
  example1.com:
    file: "example1.com.zone"
    zone_serial: '2018081301'
    zone_refresh: '3600'
    zone_retry: '7200'
    zone_expire: '3600000'
    zone_minimum: '3600'

...

Example Content for named.j2


# {{ ansible_managed }}
options {
 listen-on port 53              { any; };
 listen-on-v6 port 53           { any; };
 directory                      "/var/named";
 dump-file                      "/var/named/data/cache_dump.db";
 statistics-file                "/var/named/data/named_stats.txt";
 memstatistics-file             "/var/named/data/named_mem_stats.txt";
 pid-file                       "/run/named/named.pid";
 session-keyfile                "/run/named/session.key";
 allow-query                    { any; };
 recursion                      no;
 version                        "AIX 5.1.0";
 auth-nxdomain                  no;
 dnssec-enable                  yes;
 dnssec-validation              auto;
 bindkeys-file                  "/etc/named.iscdlv.key";
 managed-keys-directory         "/var/named/dynamic";
 transfers-out                  100;
};

logging {
 channel  default_debug {
 file     "data/named.run";
 severity dynamic;
 };
};

# START ZONES
{% for key, value in zones.iteritems() %}
zone "{{ key }}" {
 type           master;
 file           "/var/named/data/{{ value.file }}";
 allow-transfer { none; };
};
{% endfor %}
# END OF ZONES

License


GPL v 3.0

Author Information


Informazioni sul progetto

Role for configuring bind9

Installa
ansible-galaxy install tenhishadow.manage_bind
Licenza
gpl-3.0
Download
21.5k
Proprietario
DevOps