infrastructure/playbooks/roles/software/tasks/systemd-resolved.yml

35 lines
831 B
YAML
Raw Normal View History

2024-10-31 21:05:04 +00:00
- 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