system/tasks/systemd-resolved.yml
2024-03-10 10:06:23 +01:00

44 lines
996 B
YAML

---
- name: Install Systemd-resolved
ansible.builtin.package:
name: systemd-resolved
state: present
become: true
when: ansible_os_family == "RedHat" or ansible_os_family == "Debian"
- name: Install systemd-resolvconf
ansible.builtin.package:
name: systemd-resolvconf
state: present
when: ansible_os_family == "Archlinux"
become: true
- name: Enable Systemd-resolved
ansible.builtin.service:
name: systemd-resolved
state: started
enabled: true
become: true
- name: Restart Systemd-resolved
ansible.builtin.service:
name: systemd-resolved
state: restarted
become: true
when: ansible_os_family == "Debian"
- name: Restart Systemd-resolved
ansible.builtin.service:
name: dhcpcd
state: restarted
become: true
when: ansible_os_family == "Debian"
- name: Link resolv.conf
become: true
ansible.builtin.file:
state: link
src: "/run/systemd/resolve/stub-resolv.conf"
path: "/etc/resolv.conf"
force: true