pending changes
All checks were successful
ansible-lint / lint-everything (push) Successful in 1m18s
All checks were successful
ansible-lint / lint-everything (push) Successful in 1m18s
This commit is contained in:
68
roles/nsd/tasks/main.yml
Normal file
68
roles/nsd/tasks/main.yml
Normal file
@@ -0,0 +1,68 @@
|
||||
---
|
||||
|
||||
- name: Install & check prerequisites
|
||||
ansible.builtin.include_tasks: prerequisites.yml
|
||||
|
||||
- name: Create slave group
|
||||
ansible.builtin.group_by:
|
||||
key: slave_nsdservers
|
||||
when: not nsd_master
|
||||
|
||||
- name: Create master group
|
||||
ansible.builtin.group_by:
|
||||
key: master_nsdservers
|
||||
when: nsd_master
|
||||
|
||||
- name: Create zone dir
|
||||
ansible.builtin.file:
|
||||
path: "{{ nsd_default_etc_path }}zones"
|
||||
owner: nsd
|
||||
group: nsd
|
||||
mode: "0o755"
|
||||
state: directory
|
||||
|
||||
- name: Create key dir
|
||||
ansible.builtin.file:
|
||||
path: "{{ nsd_default_etc_path }}keys"
|
||||
owner: nsd
|
||||
group: nsd
|
||||
mode: "0o700"
|
||||
state: directory
|
||||
|
||||
- name: Create nsd.conf
|
||||
ansible.builtin.template:
|
||||
src: nsd.conf.j2
|
||||
dest: "{{ nsd_default_etc_path }}nsd.conf"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0o640"
|
||||
notify:
|
||||
- Restart nsd
|
||||
|
||||
- name: Create each zone in NSD
|
||||
ansible.builtin.template:
|
||||
src: zone.j2
|
||||
dest: "{{ nsd_default_etc_path }}nsd.conf.d/{{ item.name }}.conf"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0o644"
|
||||
loop: "{{ zones }}"
|
||||
notify:
|
||||
- Restart nsd
|
||||
|
||||
- name: Force zone reload
|
||||
ansible.builtin.meta: flush_handlers
|
||||
|
||||
- name: Create zone and reload
|
||||
ansible.builtin.include_tasks: zones.yml
|
||||
loop: "{{ zones }}"
|
||||
when: nsd_master
|
||||
|
||||
- name: Install renew cron
|
||||
ansible.builtin.include_tasks: cron.yml
|
||||
when: nsd_master
|
||||
|
||||
- name: Ensure nsd is started
|
||||
ansible.builtin.service:
|
||||
name: nsd
|
||||
state: started
|
Reference in New Issue
Block a user