Files
CoM-ghost_protocol/phantom/playbooks/dns/tasks/configure.yml
T
n0mad1k 701f7078f5 Fix Pi-hole deployment: remove undefined 'update gravity' handler notify
The 'Add aggressive blocklists' task notified a handler that didn't exist
in main.yml, causing deployment failure. Removed the notify since the
gravity update is already handled by the subsequent task.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 14:24:14 -04:00

66 lines
1.8 KiB
YAML

---
# Pi-hole native configuration
- name: Generate Pi-hole admin password
command: openssl rand -base64 16
register: pihole_password_gen
args:
creates: /etc/pihole/.phantom_password
- name: Save admin password
copy:
content: "{{ pihole_password_gen.stdout }}"
dest: /etc/pihole/.phantom_password
mode: "0600"
when: pihole_password_gen.changed
- name: Read saved password
slurp:
src: /etc/pihole/.phantom_password
register: pihole_password_file
- name: Set Pi-hole admin password
command: "pihole -a -p {{ (pihole_password_file.content | b64decode).strip() }}"
changed_when: true
- name: Set upstream DNS servers
command: "pihole -a setdns {{ pihole_upstream | replace(';', ' ') }}"
changed_when: true
- name: Configure blocklist level
block:
- name: Update gravity (standard blocklist)
command: pihole -g
changed_when: true
when: pihole_blocklist == "standard"
- name: Add aggressive blocklists
lineinfile:
path: /etc/pihole/adlists.list
line: "{{ item }}"
create: true
mode: "0644"
loop:
- "https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts"
- "https://raw.githubusercontent.com/hagezi/dns-blocklists/main/adblock/pro.txt"
when: pihole_blocklist == "aggressive"
- name: Update gravity after blocklist changes
command: pihole -g
changed_when: true
when: pihole_blocklist == "aggressive"
- name: Enable DNSSEC
command: pihole -a dnssec on
changed_when: true
- name: Ensure pihole-FTL is running
service:
name: pihole-FTL
state: started
enabled: true
- name: Display admin credentials
debug:
msg: "Pi-hole admin password saved to /etc/pihole/.phantom_password — access admin at http://{{ ansible_default_ipv4.address | default('server_ip') }}/admin"