34 lines
831 B
YAML
34 lines
831 B
YAML
- name: Install systemd-resolved
|
|
ansible.builtin.apt:
|
|
pkg:
|
|
- systemd-resolved
|
|
state: present
|
|
update_cache: true
|
|
become: true
|
|
|
|
- name: Enable systemd-resolved
|
|
ansible.builtin.systemd_service:
|
|
name: systemd-resolved.service
|
|
state: started
|
|
enabled: true
|
|
daemon_reload: true
|
|
become: true
|
|
register: systemd_resolved_started
|
|
|
|
- name: Restart other dns-related services
|
|
ansible.builtin.systemd_service:
|
|
name: "{{ item }}.service"
|
|
state: restarted
|
|
daemon_reload: true
|
|
become: true
|
|
when: systemd_resolved_started.changed # noqa: no-handler TODO can we add a handler here?
|
|
loop:
|
|
- tailscaled
|
|
|
|
- name: Create resolv.conf symlink
|
|
ansible.builtin.file:
|
|
src: /run/systemd/resolve/stub-resolv.conf
|
|
dest: /etc/resolv.conf
|
|
force: true
|
|
state: link
|
|
become: true
|