Common: Manage DNS

This commit is contained in:
Tobias Manske 2023-09-12 10:49:23 +02:00
parent a8b764d115
commit b4b4ae6e29
Signed by: tobias
GPG Key ID: 9164B527694A0709

View File

@ -60,12 +60,27 @@
owner: root owner: root
group: root group: root
mode: '0600' mode: '0600'
notify: Reload Network notify: Restart Network
- name: Setup DNS
ansible.builtin.lineinfile:
path: /etc/systemd/resolved.conf
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
notify: Restart systemd-resolved
loop:
- regexp: "^DNS="
line: "DNS=1.1.1.1"
- regexp: "^FallbackDNS="
line: "FallbackDNS=8.8.8.8"
handlers: handlers:
- name: Reload Network - name: Restart Network
ansible.builtin.systemd: ansible.builtin.systemd:
name: NetworkManager.service name: NetworkManager.service
state: restarted state: restarted
- name: Restart systemd-resolved
ansible.builtin.systemd:
name: systemd-resolved.service
state: restarted
- name: Backup - name: Backup