Fixing bind9 config

This commit is contained in:
2022-08-28 08:35:43 -04:00
parent 20d18ec966
commit aedf86ef0a
6 changed files with 61 additions and 129 deletions

View File

@@ -5,35 +5,16 @@
- name: install bind package
apt:
name: "{{ item }}"
# update_cache: yes
# cache_valid_time: 86400
state: latest
with_items:
- bind9
- name: set correct permissions for logging
file:
state=directory
path=/var/log/named/
recurse=yes
owner={{ bind.user }}
group={{ bind.group }}
mode=0777
- name: set correct permissions on cache
file:
state: directory
path: /var/cache/bind/
owner: "{{ bind.user }}"
group: "{{ bind.group }}"
recurse: yes
- name: copy zone files to /etc/bind/
template:
src: "{{ item }}.j2"
dest: /etc/bind/db.{{ item }}
owner: "{{ bind.user }}"
group: "{{ bind.group }}"
owner: root
group: root
mode: 0644
with_items: "{{ bind.zonefiles }}"
notify:
@@ -47,7 +28,12 @@
- 4.168.192.IN-ADDR.ARPA. /etc/bind/db.xai-corp.net.reverse
- name: copy named.confs to /etc/bind/
template: src={{ item }}.j2 dest=/etc/bind/{{ item }} owner={{ bind.user }} group={{ bind.group }} mode=0640
template:
src: "{{ item }}.j2"
dest: "/etc/bind/{{ item }}"
owner: root
group: "{{ bind.group }}"
mode: 0644
with_items: "{{ bind.namedfiles }}"
notify:
- restart bind
@@ -59,14 +45,9 @@
- name: set named startup options
ansible.builtin.copy:
content: OPTIONS="-d1"
content: OPTIONS="{{ bind.named.options }}"
dest: /etc/default/named
- name: set permisions on rndc.key
ansible.builtin.file:
mode: 644
path: /etc/bind/rndc.key
- name: remove old named sysconfig options
file:
state: absent