feat(pihole): add the pihole role #372

Merged
Defame1297 merged 10 commits from feat/pihole-role into main 2026-11-25 19:37:22 +00:00
Owner

Summary

Adds mortis.kamino.pihole: installs Pi-hole v6 on Ubuntu noble from the upstream repository (unattended installer), rendering pihole.toml from pihole_default merged with pihole_overrides. pihole_web_password is a required no_log input. Derived from codeberg.org/ansible/pihole (GPL-3.0-only) with Pi-hole FTL comment text (EUPL-1.2), recorded in REUSE.toml, NOTICE and LICENSES/EUPL-1.2.txt. Names pihole in the README and the Galaxy description and removes it from the README roadmap.

Interface notes:

  • Inputs: pihole_web_password (required), pihole_overrides, pihole_default, pihole_testing, pihole_testing_timeout, pihole_install_script. pihole_default and pihole_install_script stay out of the argument spec (reason in the spec and README).
  • The input asserts, the settings merge and the installed and configuration-directory checks run under always, so no tag selection leaves a fact undefined; config-only selects the reconfigure step.
  • Molecule's sequence runs check before converge and after idempotence. On a first run under --check the configuration directory does not exist yet, so the template tasks are skipped.
  • Platforms: noble only, like the other Ubuntu roles. Resolute is listed as an untested platform in the README: the molecule-ubuntu2604 image cannot become (#376), so the scenario cannot run there yet.

Verified

  • pre-commit run --all-files, scripts/ansible-test-sanity.sh on HEAD and reuse lint: pass.
  • ansible-playbook --list-tasks on a scratch play with no tags, --tags config-only, --skip-tags config-only, --skip-tags default and --skip-tags updates-only: every fact-only task is listed in each case.
  • Two independent reviews (role logic and parity; scenario, licensing and docs) and a re-review of the fixes; their findings are fixed in the later commits.
  • Incoming diff searched for references to other repositories, hostnames, private addresses and issue numbers; none found.

Not verified

  • Molecule (default scenario on noble, check runs, negative tests, clone version and ownership asserts): runs in CI on this pull request. The first run failed only on the resolute instance (#376), which this PR no longer tests.
  • The real Pi-hole installer and pihole-FTL: the scenario uses a stub installer, so whether the service loaded the configuration is not tested.

Known, not changed here

  • The template always renders app_pwhash, so with an empty app_password it holds the hash of the empty string; this is the upstream behaviour and is left for a separate change.

Assisted-by: Claude Code:claude-opus-5-5

## Summary Adds `mortis.kamino.pihole`: installs Pi-hole v6 on Ubuntu noble from the upstream repository (unattended installer), rendering `pihole.toml` from `pihole_default` merged with `pihole_overrides`. `pihole_web_password` is a required `no_log` input. Derived from codeberg.org/ansible/pihole (GPL-3.0-only) with Pi-hole FTL comment text (EUPL-1.2), recorded in `REUSE.toml`, `NOTICE` and `LICENSES/EUPL-1.2.txt`. Names pihole in the README and the Galaxy description and removes it from the README roadmap. Interface notes: - Inputs: `pihole_web_password` (required), `pihole_overrides`, `pihole_default`, `pihole_testing`, `pihole_testing_timeout`, `pihole_install_script`. `pihole_default` and `pihole_install_script` stay out of the argument spec (reason in the spec and README). - The input asserts, the settings merge and the installed and configuration-directory checks run under `always`, so no tag selection leaves a fact undefined; `config-only` selects the reconfigure step. - Molecule's sequence runs `check` before converge and after idempotence. On a first run under `--check` the configuration directory does not exist yet, so the template tasks are skipped. - Platforms: `noble` only, like the other Ubuntu roles. Resolute is listed as an untested platform in the README: the `molecule-ubuntu2604` image cannot `become` (#376), so the scenario cannot run there yet. ## Verified - `pre-commit run --all-files`, `scripts/ansible-test-sanity.sh` on HEAD and `reuse lint`: pass. - `ansible-playbook --list-tasks` on a scratch play with no tags, `--tags config-only`, `--skip-tags config-only`, `--skip-tags default` and `--skip-tags updates-only`: every fact-only task is listed in each case. - Two independent reviews (role logic and parity; scenario, licensing and docs) and a re-review of the fixes; their findings are fixed in the later commits. - Incoming diff searched for references to other repositories, hostnames, private addresses and issue numbers; none found. ## Not verified - Molecule (default scenario on noble, check runs, negative tests, clone version and ownership asserts): runs in CI on this pull request. The first run failed only on the resolute instance (#376), which this PR no longer tests. - The real Pi-hole installer and pihole-FTL: the scenario uses a stub installer, so whether the service loaded the configuration is not tested. ## Known, not changed here - The template always renders `app_pwhash`, so with an empty `app_password` it holds the hash of the empty string; this is the upstream behaviour and is left for a separate change. Assisted-by: Claude Code:claude-opus-5-5
Claude added 2 commits 2026-11-25 18:19:57 +00:00
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
test(pihole): add the default molecule scenario
Build / build (pull_request) Successful in 27s
Lint / lint (pull_request) Successful in 2m7s
Molecule / molecule (pull_request) Failing after 2m27s
bf6f9b5800
Runs on noble and resolute without the real Pi-hole: the clone target
is a local git repository whose installer is a stub that logs its
arguments and creates the database file.

Covers a check run before the converge and after idempotence, the
merge, the rendered pihole.toml (upstreams, interface, hashed
password, owner and mode), the system user, the installer sequence
(install once, then reconfigure from the handler) and a negative test
for every validation: no Ubuntu facts, a missing pihole_web_password,
an unset interface, empty upstreams, a non-string and a placeholder
password. No pihole-FTL service runs, so the loaded configuration is
not verified.

Assisted-by: Claude Code:claude-opus-5-5
Defame1297 added 5 commits 2026-11-25 19:14:35 +00:00
Remove the pihole_force_install input, which had no effect, and the dead
term of the install condition. Tag the merge and the configuration
directory check always, so --skip-tags config-only no longer skips facts
that later tasks read. Skip the installer log under --check, where the
installer did not run. Read the env and user_id facts through
ansible_facts, drop a redundant default, state the real reasons two
defaults stay out of the argument spec, and bring the README to the
fixed heading set.

Assisted-by: Claude Code:claude-opus-5-5
verify.yml now checks the group of pihole.toml, the owner, group and mode
of /etc/pihole, and that the clone is checked out at the repo.version the
converge used, read from the role defaults. The molecule.yml comment
describes the test sequence accurately.

Assisted-by: Claude Code:claude-opus-5-5
Assisted-by: Claude Code:claude-opus-5-5
fix(pihole): run every fact-only task whatever tags are skipped
Build / build (pull_request) Successful in 27s
Molecule / molecule (pull_request) Failing after 1m2s
Lint / lint (pull_request) Successful in 1m52s
910d79768a
The installed check carried only updates-only and the merge kept its own
default tag, so skipping either left a fact undefined that untagged tasks
read. Both now run under always alone, and the README Tags section no
longer names updates-only, which selected nothing else.

Assisted-by: Claude Code:claude-opus-5-5
Claude marked the pull request as ready for review 2026-11-25 19:14:47 +00:00
CODEOWNERS rules requested review from Defame1297 2026-11-25 19:14:48 +00:00
Defame1297 added 1 commit 2026-11-25 19:23:28 +00:00
Merge branch 'main' into feat/pihole-role
Build / build (pull_request) Successful in 27s
Molecule / molecule (pull_request) Failing after 1m8s
Lint / lint (pull_request) Successful in 1m53s
a9a332457b
Defame1297 added 2 commits 2026-11-25 19:33:58 +00:00
The molecule-ubuntu2604 image cannot become root: sudo refuses with an
account validation failure, so resolute is not testable yet. Like the
other Ubuntu roles, pihole declares noble only and names resolute as an
untested platform in its README.

Assisted-by: Claude Code:claude-opus-5-5
Merge remote-tracking branch 'origin/feat/pihole-role' into feat/pihole-role
Build / build (pull_request) Successful in 30s
Lint / lint (pull_request) Successful in 1m57s
Molecule / molecule (pull_request) Successful in 1m36s
0a5a5c532a
Defame1297 approved these changes 2026-11-25 19:37:12 +00:00
Defame1297 merged commit 428b88a822 into main 2026-11-25 19:37:22 +00:00
Defame1297 deleted branch feat/pihole-role 2026-11-25 19:37:26 +00:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mortis/Kamino#372