full-dns/tasks/nsd.yml
2020-08-03 19:25:51 +02:00

56 lines
1.2 KiB
YAML

---
- name: Ensure bullseye backports apt sources are present
copy:
content: |
deb http://http.debian.net/debian testing main contrib
dest: /etc/apt/sources.list.d/testing.list
owner: root
group: root
mode: 0600
register: testing_sources
- name: Ensure only nsd is taken from testing
copy:
content: |
Package: nsd
Pin: release a=testing
Pin-Priority: 999
Package: *
Pin: release a=stable
Pin-Priority: 700
dest: /etc/apt/preferences.d/10-nsd-related
owner: root
group: root
mode: 0600
register: repo_config
- name: Ensure repo are up-to-date
apt:
update_cache: yes
when: repo_config.changed or testing_sources.changed
- name: Ensure nsd is present
apt:
name: nsd
state: latest
- fail:
msg: "Required nsd_addr is missing"
when: server.nsd_addr is not defined
- fail:
msg: "Required nsd_port is missing"
when: server.nsd_port is not defined
- name: Ensure main nsd conf is present
template:
src: templates/nsd.conf.j2
dest: /etc/nsd/nsd.conf.d/00-server.conf
owner: root
group: root
mode: 0600
notify: restart nsd
- meta: flush_handlers