74 lines
No EOL
2.2 KiB
YAML
74 lines
No EOL
2.2 KiB
YAML
- name: Configure DNS servers
|
|
hosts: routers
|
|
remote_user: root
|
|
tasks:
|
|
- name: Install bind on Arch
|
|
ansible.builtin.package:
|
|
name: bind
|
|
state: present
|
|
when: ansible_distribution == 'Archlinux'
|
|
- name: Install bind on Debian
|
|
ansible.builtin.package:
|
|
name: bind9
|
|
state: present
|
|
when: ansible_distribution == 'Debian'
|
|
- name: Configure DNS server named.conf files
|
|
ansible.builtin.template:
|
|
src: dns/named.conf.j2
|
|
dest: /etc/named.conf
|
|
mode: '0644'
|
|
- name: Use our config file on Debian
|
|
ansible.builtin.copy:
|
|
src: dns/named-debian.conf
|
|
dest: /etc/bind/named.conf
|
|
mode: '0644'
|
|
when: ansible_distribution == 'Debian'
|
|
- name: Ensure /var/named exists on Arch
|
|
ansible.builtin.file:
|
|
path: /var/named
|
|
state: directory
|
|
mode: '0770'
|
|
owner: root
|
|
group: named
|
|
when: ansible_distribution == 'Archlinux'
|
|
- name: Ensure /var/named exists on Debian
|
|
ansible.builtin.file:
|
|
path: /var/named
|
|
state: directory
|
|
mode: '0770'
|
|
owner: root
|
|
group: bind
|
|
when: ansible_distribution == 'Debian'
|
|
- name: Add DNS dummy interface netdev
|
|
ansible.builtin.copy:
|
|
src: dns/igp-dummy-dns.netdev
|
|
dest: /etc/systemd/network/igp-dummy-dns.netdev
|
|
mode: '0644'
|
|
- name: Add DNS dummy interface network
|
|
ansible.builtin.copy:
|
|
src: dns/igp-dummy-dns.network
|
|
dest: /etc/systemd/network/igp-dummy-dns.network
|
|
mode: '0644'
|
|
- name: Reload named
|
|
ansible.builtin.systemd:
|
|
name: named
|
|
state: reloaded
|
|
enabled: true
|
|
- name: Reload systemd-networkd
|
|
ansible.builtin.command: networkctl reload
|
|
- name: Turn off systemd-resolved
|
|
ansible.builtin.systemd:
|
|
name: systemd-resolved
|
|
state: stopped
|
|
enabled: false
|
|
ignore_errors: true
|
|
- name: Push resolv.conf
|
|
ansible.builtin.copy:
|
|
src: dns/resolv.conf
|
|
dest: /etc/resolv.conf
|
|
mode: '0644'
|
|
- name: Suppress proxmox resolv.conf meddling
|
|
ansible.builtin.file:
|
|
path: /etc/.pve-ignore-resolv.conf
|
|
state: touch
|
|
mode: '0644' |