42 lines
1011 B
YAML
42 lines
1011 B
YAML
- name: Update apt cache
|
|
apt:
|
|
update_cache: yes
|
|
- name: Install bind package requirements
|
|
apt:
|
|
name: "{{ bind_packages }}"
|
|
state: present
|
|
install_recommends: no
|
|
- name: Ensure BIND9 starts with IPv4 only (-4)
|
|
lineinfile:
|
|
path: /etc/default/named
|
|
regexp: '^OPTIONS='
|
|
line: 'OPTIONS="-u bind -4"'
|
|
backrefs: yes
|
|
notify: restart-dns
|
|
- name: Create directory
|
|
file:
|
|
path: "{{ item.path }}"
|
|
state: directory
|
|
owner: "{{ item.group }}"
|
|
group: "{{ item.group }}"
|
|
mode: "{{ item.mode }}"
|
|
loop: "{{ directory }}"
|
|
- name: Copy required files and scripts
|
|
copy:
|
|
src: "{{ item.src }}"
|
|
dest: "{{ item.dest }}"
|
|
owner: "{{ item.group }}"
|
|
group: "{{ item.group }}"
|
|
mode: "{{ item.mode }}"
|
|
loop: "{{ required_files }}"
|
|
- name: Deploy BIND config templates
|
|
template:
|
|
src: "{{ item.src }}"
|
|
dest: "{{ item.dest }}"
|
|
owner: root
|
|
group: bind
|
|
mode: "{{ item.mode }}"
|
|
loop: "{{ bind_config_templates }}"
|
|
notify: restart-dns
|
|
|