diff --git a/README.md b/README.md index fdfb239..c389106 100644 --- a/README.md +++ b/README.md @@ -2,16 +2,20 @@ # Ansible Bind Role -An ansible role for installing and managing bind, acting as primary and/or secondary nameserver. -It does also copy the master zone files (`bind_masterzones_path`), but however, the zone files must exist. +An ansible role for installing and managing bind, acting as primary and/or secondary nameserver. +It does also copy the master zone files (`bind_masterzones_path`), but however, the zone files must exist in the local machine (`bind_masterzones_local_path`). ## Configuration: -Define where your zones files are stored: +Define where your zones files are stored in the server: bind_masterzones_path: path/to/zones_dir +Define where your zones files are stored in the ansible controller machine: + + bind_masterzones_local_path: path/to/zones/local/dir/ + Configure the domains of the zones for a bind act as primary nameserver: bind_config_master_zones: diff --git a/defaults/main.yml b/defaults/main.yml index 6a6e3df..d9ee85f 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -10,6 +10,7 @@ bind_service_enabled: yes bind_pkg_state: installed bind_base_zones_path: "/var/lib/bind" bind_masterzones_path: "masters" +bind_masterzones_local_path: "masters" bind_slavezones_path: "slaves" bind_config_listen_on: any bind_config_allow_query: [] diff --git a/tasks/main.yml b/tasks/main.yml index 50b442c..cbd2691 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -26,7 +26,7 @@ notify: restart bind - name: Copy master zone files - copy: src={{ bind_masterzones_path }}/db.{{ item.name }} dest={{ bind_base_zones_path }}/{{bind_masterzones_path}} owner={{ bind_user }} group={{ bind_group }} + copy: src={{ bind_masterzones_local_path }}/db.{{ item.name }} dest={{ bind_base_zones_path }}/{{bind_masterzones_path}} owner={{ bind_user }} group={{ bind_group }} with_items: "{{ bind_config_master_zones }}" notify: reload bind tags: bind-zones