aboutsummaryrefslogtreecommitdiff
path: root/roles/bind/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'roles/bind/tasks')
-rw-r--r--roles/bind/tasks/download_zonefile.yml15
-rw-r--r--roles/bind/tasks/main.yml33
2 files changed, 48 insertions, 0 deletions
diff --git a/roles/bind/tasks/download_zonefile.yml b/roles/bind/tasks/download_zonefile.yml
new file mode 100644
index 0000000..9e89507
--- /dev/null
+++ b/roles/bind/tasks/download_zonefile.yml
@@ -0,0 +1,15 @@
+---
+- name: Download zonefile
+ uri:
+ url: '{{ bind_zonefile_base_url }}/{{ item }}'
+ return_content: yes
+ delegate_to: localhost
+ register: zonefile
+
+- name: Install zonefile
+ copy:
+ dest: '/etc/bind/zonefiles/{{ item }}'
+ content: '{{ zonefile.content }}'
+ become: yes
+ notify: Restart bind
+
diff --git a/roles/bind/tasks/main.yml b/roles/bind/tasks/main.yml
new file mode 100644
index 0000000..603e142
--- /dev/null
+++ b/roles/bind/tasks/main.yml
@@ -0,0 +1,33 @@
+---
+- name: Install BIND9
+ ansible.builtin.apt:
+ name:
+ - bind9
+ - bind9utils
+ - bind9-doc
+ become: yes
+
+- name: Copy configuration
+ copy:
+ src: named.conf.options
+ dest: /etc/bind/named.conf.options
+ become: yes
+ notify: Restart bind
+
+- name: Install zone config
+ template:
+ src: named.conf.local.j2
+ dest: /etc/bind/named.conf.local
+ become: yes
+ notify: Restart bind
+
+- name: Create folder
+ file:
+ state: directory
+ path: /etc/bind/zonefiles
+ become: yes
+
+- name: Download and install Zonefiles
+ include_tasks: download_zonefile.yml
+ when: bind_install_zonefiles
+ loop: '{{ bind_zones }}'