mirror of
https://github.com/dredx/prole.git
synced 2026-09-23 11:03:59 +00:00
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>
35 lines
1.0 KiB
YAML
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 }}"
|