prole/infrastructure/playbooks/pihole_flush_dns.yml
chrisfu 3ada16c875 feat(infrastructure): add Pi-hole DNS flush playbook and logs dir
infrastructure/playbooks/pihole_flush_dns.yml — Ansible playbook to
flush Pi-hole DNS cache across inventory hosts.

infrastructure/logs/ — log directory for Ansible run output.

Co-authored-by: Junie <junie@jetbrains.com>
2026-05-23 21:31:52 -07:00

35 lines
1.0 KiB
YAML

---
# pihole_flush_dns.yml
# Flush and reload DNS on all Pi-hole instances in sequence.
# Runs serially (serial: 1) so one resolver is always available.
#
# Usage:
# ansible-playbook -i inventory/hosts.ini playbooks/pihole_flush_dns.yml
# ansible-playbook -i inventory/hosts.ini playbooks/pihole_flush_dns.yml --limit pi.prole.org
- name: Flush and reload Pi-hole DNS cache
hosts: pihole
serial: 1 # one at a time — keep a resolver up at all times
become: true
gather_facts: false
tasks:
- name: Flush cache and reload lists (Pi-hole v6+)
command: pihole reloaddns
register: pihole_reload
changed_when: true
- name: Show pihole reloaddns output
debug:
msg: "{{ pihole_reload.stdout_lines }}"
when: pihole_reload.stdout_lines | length > 0
- name: Verify pihole-FTL is running
command: pihole status
register: pihole_status
changed_when: false
- name: Show Pi-hole status
debug:
msg: "{{ pihole_status.stdout_lines }}"