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
94 lines
4.5 KiB
YAML
94 lines
4.5 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: argument validation
|
|
templates every listed variable, and their defaults read gathered facts and the merged settings, which do
|
|
not exist yet when it runs. 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_force_install:
|
|
type: bool
|
|
default: false
|
|
description:
|
|
- >-
|
|
No effect: the install task condition ends in C(or true). Whether the installer runs depends only on
|
|
C(config.files.database) not existing yet.
|
|
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.
|