aalaesar.manage-bind

Ansible Role: manage-bind 2.0

This role helps you set up and configure BIND (a DNS server) using simple YAML files.

Features

  • Install and manage BIND9 on Debian/Ubuntu servers.
  • Use YAML to configure BIND options and DNS zones.

Requirements

Ansible 2.4 or higher.

Note: You need root access to the BIND server.

Example Playbook

- hosts: dnsserver
  roles:
    - role: aalaesar.manage-bind
      become: yes

Role Variables

Here's a quick overview of important configuration settings:

# User and group settings
bind_user: bind
bind_group: bind

# Logging directory
bind_log_dir: /var/log/bind

# BIND installation settings
bind_service_state: started
bind_service_enabled: yes
# Config directory
bind_configs_dir: /etc/bind
# Zone configuration
bind_zones_dir: /var/lib/bind
remove_unmanaged_files: true
list_zone_files: []

Configuring BIND

How BIND's Configuration Works

BIND uses a concept of clauses to manage configurations.

  • A clause is a type of category with its own rules.
  • A statement is a rule that defines how BIND operates.

Example of Clause Inheritance:

|##########|  
|  zone1   |  
|==========|  
|statement1|  
|  =john   |  
|##########|  

|############################|  
|          Options           |  
|============================|  
|   statement1=foo          |  
|   statement2=koala        |  
|############################|  

Clauses Supported

  • options
  • zone
  • key

Important Notes

  • Define statements carefully, as some require simple values while others have more complex structures.
  • Quotes are needed for special characters and "yes"/"no" values.

Zone Configurations

Zones are defined with statements in a playbook.

Example Zone Declaration

zones:
  example.com:
    type: master

Defining Zone Records

Records for a zone can be declared directly in the playbook or in separate YAML files.

Example of Zone Records

zones:
  example.com:
    records:
      SOA: ...
      NS: ...
      A:
        localhost: 127.0.0.1

Example Playbooks

Playbook for dnserver1

- hosts: dnserver1
  roles:
    - role: aalaesar.manage-bind
      options:
        allow_recursion: '55.66.77.88'
      zones:
        example.tld:
          type: master
          notify: '55.66.77.88'
          records:
            - SOA:
                serial: 2016080401
                ns: dnserver1.example.tld.
                email: admin.example.tld.

Playbook for dnserver2

- hosts: dnserver2
  roles:
    - role: aalaesar.manage-bind
      options:
        allow_recursion: '11.22.33.44'
      zones:
        example.com:
          type: slave

License

This project uses the BSD license.

Informazioni sul progetto

Use YAML syntax/files to configure Bind (options, zones data, etc) from Ansible. (Also install and manage the bind9 server on Debian/Ubuntu servers).

Installa
ansible-galaxy install aalaesar.manage-bind
Licenza
Unknown
Download
568
Proprietario
Yet another DevOps. I just want things to become easier and faster, ... and understand how it works ! That's a lot of work ...