Files
Kamino/roles/pihole/tasks/merge-defaults.yml
T
Defame1297 66628635b9 feat(pihole): add the pihole role
Installs Pi-hole v6 on Ubuntu noble and resolute by cloning the
upstream repository and running its installer unattended, with
pihole.toml rendered from pihole_default merged with pihole_overrides.
A change to pihole.toml runs the installer's reconfigure mode.

Validation runs first under always: the host must be Ubuntu, and the
merged settings need a non-empty interface and upstream list and a
string password other than the placeholder. pihole_web_password is a
required no_log input. Computed values are internal __pihole_ names.

Derived from codeberg.org/ansible/pihole (GPL-3.0-only) with Pi-hole
FTL comment text (EUPL-1.2): REUSE.toml annotations, the EUPL-1.2
text and NOTICE entries record both. The README roadmap drops pihole.

Assisted-by: Claude Code:claude-opus-5-5
2026-11-25 18:10:59 +00:00

25 lines
1.1 KiB
YAML

---
# "pihole_overrides" is only read here: the merged result goes into the fact
# "__pihole_effective", so the input is never overwritten and every run recomputes the merge.
# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/combine_filter.html
- name: Merge overrides over the default variable
tags: default
ansible.builtin.set_fact:
__pihole_effective: "{{ pihole_default | combine(pihole_overrides | default({}), recursive=True) }}"
# the merged settings hold the web password
no_log: true
# the web password, app password and TOTP secret are masked so the dump is
# safe to paste into an issue or leave in CI logs
- name: Inspect the merged settings (secrets masked)
ansible.builtin.debug:
msg: "{{ __pihole_effective | combine({'config': {'webserver': {'api': __pihole_masked_secrets}}}, recursive=True) }}"
vars:
__pihole_masked_secrets: {password: <masked>, app_password: <masked>, totp_secret: <masked>}
when: pihole_testing | bool
- name: Pausing to highlight merge result
ansible.builtin.wait_for:
timeout: "{{ pihole_testing_timeout | default(5) }}"
when: pihole_testing | bool