summaryrefslogtreecommitdiffstats
path: root/roles/pihole/tasks
diff options
context:
space:
mode:
authorAhmed Abdelhalim <[email protected]>2025-09-02 02:41:58 +0200
committerAhmed Abdelhalim <[email protected]>2025-09-02 02:41:58 +0200
commit0769d1a47f09148ce7ee3206c185004bbefb9f0b (patch)
tree891ce761d2baefb25c0df1ce16b58ce0c1a7f859 /roles/pihole/tasks
parent4c59a5a3d07ab0aa72aed3663823bbf69eec647e (diff)
Refactor the network fix for pihole
Diffstat (limited to 'roles/pihole/tasks')
-rw-r--r--roles/pihole/tasks/main.yml29
1 files changed, 4 insertions, 25 deletions
diff --git a/roles/pihole/tasks/main.yml b/roles/pihole/tasks/main.yml
index f8fe8d7d..4cd864ba 100644
--- a/roles/pihole/tasks/main.yml
+++ b/roles/pihole/tasks/main.yml
@@ -1,29 +1,8 @@
---
-- name: "Set Pi-hole DNS facts"
- ansible.builtin.set_fact:
- pihole_enabled: true
- network_ipv4_dns: "{{ ansible_default_ipv4.address }}"
- network_ipv6_dns: "{{ ansible_default_ipv6.address }}"
-
-- name: "Reconfigure systemd-resolved for Pi-hole"
- become: true
- ansible.builtin.template:
- src: "{{ role_path }}/../network/templates/resolved.conf.j2"
- dest: "/etc/systemd/resolved.conf"
- mode: "0644"
- notify:
- - "Restart systemd-resolved"
-
-- name: "Reconfigure NetworkManager connections for Pi-hole DNS"
- become: true
- ansible.builtin.template:
- src: "{{ role_path }}/../network/templates/eth0-connection.nmconnection.j2"
- dest: "/etc/NetworkManager/system-connections/ethernet.nmconnection"
- mode: "0600"
- owner: "root"
- group: "root"
- notify:
- - "Restart NetworkManager"
+- name: "Validate network_ipv*_dns params"
+ ansible.builtin.fail:
+ msg: "Pihole role cannot work when network_ipv4_dns or network_ipv6_dns are defined"
+ when: network_ipv4_dns is defined or network_ipv6_dns is defined
- name: "Crete Pi-hole user"
ansible.builtin.user: