mirror of https://dev.ccchb.de/ccchb/ansible.git
85 lines
1.7 KiB
YAML
85 lines
1.7 KiB
YAML
|
---
|
|||
|
- name: Install nsd
|
|||
|
package:
|
|||
|
name: nsd
|
|||
|
state: present
|
|||
|
|
|||
|
- name: Add /var/log/nsd to fstab
|
|||
|
mount:
|
|||
|
path: /var/log/nsd
|
|||
|
src: tmpfs
|
|||
|
fstype: tmpfs
|
|||
|
opts: 'rw,size={{ nsd_log_size }},mode={{ nsd_log_mode }},uid={{ nsd_log_uid }},gid={{ nsd_log_gid }},late'
|
|||
|
state: mounted
|
|||
|
|
|||
|
- name: Create nsd service directories
|
|||
|
file:
|
|||
|
path: '/etc/s6-rc/service/{{ item }}'
|
|||
|
state: directory
|
|||
|
owner: root
|
|||
|
group: wheel
|
|||
|
mode: 0755
|
|||
|
with_items: '{{ nsd_service_dirs }}'
|
|||
|
notify:
|
|||
|
- Reload s6-rc
|
|||
|
- Restart nsd log
|
|||
|
- Restart nsd
|
|||
|
|
|||
|
- name: Generate nsd service scripts
|
|||
|
template:
|
|||
|
dest: '/etc/s6-rc/service/{{ item }}'
|
|||
|
src: '{{ item }}.j2'
|
|||
|
mode: 0555
|
|||
|
owner: root
|
|||
|
group: wheel
|
|||
|
with_items: '{{ nsd_service_scripts }}'
|
|||
|
notify:
|
|||
|
- Reload s6-rc
|
|||
|
- Restart nsd log
|
|||
|
- Restart nsd
|
|||
|
|
|||
|
- name: Generate nsd service configuration
|
|||
|
copy:
|
|||
|
dest: '/etc/s6-rc/service/{{ item.name }}'
|
|||
|
content: '{{ item.content }}'
|
|||
|
mode: 0444
|
|||
|
owner: root
|
|||
|
group: wheel
|
|||
|
loop_control:
|
|||
|
label: '{{ item.name }} = {{ item.content }}'
|
|||
|
notify:
|
|||
|
- Reload s6-rc
|
|||
|
- Restart nsd log
|
|||
|
- Restart nsd
|
|||
|
with_items: '{{ nsd_service_config }}'
|
|||
|
|
|||
|
- name: Configure nsd
|
|||
|
template:
|
|||
|
dest: /usr/local/etc/nsd/nsd.conf
|
|||
|
src: nsd.conf.j2
|
|||
|
mode: 0444
|
|||
|
owner: root
|
|||
|
group: wheel
|
|||
|
notify:
|
|||
|
- Reload nsd
|
|||
|
|
|||
|
- name: Flush handlers
|
|||
|
meta: flush_handlers
|
|||
|
|
|||
|
- name: Start nsd
|
|||
|
command: fdmove -c 2 1 s6-rc -u -v 2 -t 15000 change nsd
|
|||
|
register: change
|
|||
|
changed_when: change.stdout | length > 0
|
|||
|
|
|||
|
- name: Enable nsd
|
|||
|
lineinfile:
|
|||
|
path: /etc/s6-rc/service/enabled/contents
|
|||
|
regexp: "^nsd$"
|
|||
|
line: nsd
|
|||
|
state: present
|
|||
|
notify:
|
|||
|
- Reload s6-rc
|
|||
|
|
|||
|
- name: Flush handlers (again)
|
|||
|
meta: flush_handlers
|