Files
Kamino/roles/pihole/meta/argument_specs.yml
T
Defame1297 d84fb4a2f4 fix(pihole): address review findings
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
2026-11-25 18:53:21 +00:00

89 lines
4.4 KiB
YAML

---
argument_specs:
main:
short_description: Install and configure Pi-hole from the upstream repository
description:
- >-
Asserts an Ubuntu host and the merged settings, merges the C(pihole_overrides) dictionary over
C(pihole_default), installs the apt dependencies, creates the C(pihole) system user, renders C(pihole.toml),
clones the upstream repository, runs its installer in unattended mode on first install, and runs the
installer's reconfigure mode when C(pihole.toml) changes.
- >-
The configuration contract is a single dictionary, C(pihole_overrides), whose keys are merged recursively
over C(pihole_default) in C(defaults/main.yml). The spec types it as a dictionary only, because sub-options
would reject every key it does not list. The merged result is an internal fact and never overwrites the
input. The role fails unless the merged C(config.dns.upstreams) is a non-empty list, C(config.dns.interface)
is a non-empty string and C(config.webserver.api.password) is a string other than
C(changetoyourownpassword).
- >-
C(pihole_default) (every setting rendered into C(pihole.toml)) and C(pihole_install_script) (the quoted
installer path under C(repo.path)) are role defaults deliberately not listed here, because argument
validation templates every listed variable. C(pihole_install_script) reads the merged settings, which the
role sets only after validation. Templating C(pihole_default) would turn a missing C(pihole_web_password)
into an undefined-variable error before the clean missing-required-arguments message. Override settings
through C(pihole_overrides) instead.
options:
pihole_web_password:
type: raw
required: true
no_log: true
description:
- >-
The Pi-hole web interface and API password, the default of the merged
C(config.webserver.api.password). A secret: source it from a vaulted variable. Required even when
C(pihole_overrides) sets the password, because the merge templates the whole of C(pihole_default),
which references it.
- The rendered C(pihole.toml) holds it hashed twice with SHA-256 (C(pwhash)).
pihole_overrides:
type: dict
default: {}
no_log: true
description:
- >-
Overrides merged recursively over C(pihole_default). Specify only the keys to change. Define the whole
dictionary in one place, because a dictionary set in two variable sources is not merged and the
higher-precedence one wins.
- >-
C(config.dns.interface) must be set (string, for example C(eth0)): its default is an empty placeholder
and the role fails until it is set. C(config.dns.upstreams) (list of IP addresses or hostnames,
optionally with C(#port)) must stay non-empty. C(config.webserver.api.password) must stay a string.
C(config.webserver.api.totp_secret) and C(config.webserver.api.app_password) are also credentials.
- >-
Other keys the tasks read are C(repo.remote), C(repo.version) (a tag, default C(v6.4)), C(repo.path)
(default C(~/.cache/pi-hole) of the connecting user), C(user), C(group) (both default C(pihole)) and
C(config.files.database) (its directory receives C(pihole.toml)). Every other key is rendered into
C(pihole.toml).
pihole_testing:
type: bool
default: false
description:
- >-
When true the role prints the merged settings with the web password, app password and TOTP secret
masked, pauses C(pihole_testing_timeout) seconds, and on a first install reads and prints the installer
log.
pihole_testing_timeout:
type: int
default: 5
description:
- Seconds to pause after the merge result is printed. Only used when C(pihole_testing) is true.
pihole_apt_dependencies:
type: list
elements: str
default:
- curl
- git
- procps
- lighttpd-mod-deflate
- apt-utils
- whiptail
- dnsutils
- bc
- unzip
- wget
- sudo
- netcat-openbsd
- cron
- iproute2
description:
- apt packages installed before the clone. Overriding replaces the whole list.