diff --git a/changelogs/fragments/pihole-role.yml b/changelogs/fragments/pihole-role.yml index 2fd9c19..5131fdb 100644 --- a/changelogs/fragments/pihole-role.yml +++ b/changelogs/fragments/pihole-role.yml @@ -1,7 +1,7 @@ --- minor_changes: - >- - pihole - New role. Installs Pi-hole v6 on Ubuntu noble and resolute by cloning the upstream repository and running + pihole - New role. Installs Pi-hole v6 on Ubuntu noble by cloning the upstream repository and running its installer unattended, with ``pihole.toml`` rendered from ``pihole_default`` merged with ``pihole_overrides``. ``pihole_web_password`` is a required secret input, and ``pihole_overrides`` must set ``config.dns.interface``. A change to ``pihole.toml`` runs the installer's reconfigure mode. Derived from codeberg.org/ansible/pihole diff --git a/roles/pihole/README.md b/roles/pihole/README.md index faf445f..3df8d4d 100644 --- a/roles/pihole/README.md +++ b/roles/pihole/README.md @@ -4,7 +4,9 @@ Installs [Pi-hole](https://pi-hole.net) v6 by cloning the upstream repository an ## Supported platforms -Ubuntu 24.04 (noble) and 26.04 (resolute), the platforms the molecule scenario runs on. The role asserts that the host is Ubuntu before any change. The package dependencies come from `ansible.builtin.apt`. The host needs outbound access to the upstream Pi-hole repository (`repo.remote` in the merged settings) and to the apt mirrors. +Ubuntu 24.04 (noble), the platform the molecule scenario runs on. The role asserts that the host is Ubuntu before any change. The package dependencies come from `ansible.builtin.apt`. The host needs outbound access to the upstream Pi-hole repository (`repo.remote` in the merged settings) and to the apt mirrors. + +Untested platforms: Ubuntu 26.04 (resolute). The apt dependencies exist there, but the scenario does not run on it yet. The role targets Ubuntu hosts that serve DNS, not Proxmox nodes, so it does not cover Debian trixie: the upstream installer is run on the Ubuntu hosts it is tested on. @@ -58,7 +60,7 @@ The input asserts carry `always` (and `assert`), so they run whatever tags are s ## Tests -The `default` molecule scenario runs on noble and resolute. It replaces the upstream repository with a local stub whose installer only logs its arguments and creates the database file, so it tests the merge, the asserts, the user, the configuration directory and the rendered `pihole.toml` (owner, group and mode), the clone's checked-out version, the installer sequence (install once, then reconfigure from the handler) and idempotence, not Pi-hole itself: no pihole-FTL service runs, so that the service loaded the configuration is not verified. It runs `check` before the converge (a first-run preview) and after the idempotence run. Negative tests in `verify.yml` cover a host without Ubuntu facts, a missing `pihole_web_password`, an unset interface, empty upstreams, a non-string password and the placeholder password. +The `default` molecule scenario runs on noble. It replaces the upstream repository with a local stub whose installer only logs its arguments and creates the database file, so it tests the merge, the asserts, the user, the configuration directory and the rendered `pihole.toml` (owner, group and mode), the clone's checked-out version, the installer sequence (install once, then reconfigure from the handler) and idempotence, not Pi-hole itself: no pihole-FTL service runs, so that the service loaded the configuration is not verified. It runs `check` before the converge (a first-run preview) and after the idempotence run. Negative tests in `verify.yml` cover a host without Ubuntu facts, a missing `pihole_web_password`, an unset interface, empty upstreams, a non-string password and the placeholder password. ## Notes diff --git a/roles/pihole/meta/main.yml b/roles/pihole/meta/main.yml index 3565700..09ba141 100644 --- a/roles/pihole/meta/main.yml +++ b/roles/pihole/meta/main.yml @@ -10,7 +10,6 @@ galaxy_info: - name: Ubuntu versions: - noble - - resolute galaxy_tags: - pihole - dns diff --git a/roles/pihole/molecule/default/molecule.yml b/roles/pihole/molecule/default/molecule.yml index 3856b2f..a81d233 100644 --- a/roles/pihole/molecule/default/molecule.yml +++ b/roles/pihole/molecule/default/molecule.yml @@ -1,7 +1,6 @@ --- -# Runs on the repository's own runner (label kamino-molecule), on both declared platforms: -# molecule-ubuntu2404 (MOLECULE_IMAGE) and molecule-ubuntu2604 (MOLECULE_IMAGE_2604), the pins in -# .gitea/workflows/molecule.yml. Needs outbound network for the apt packages. The upstream +# Runs on the repository's own runner (label kamino-molecule), in the molecule-ubuntu2404 image +# (MOLECULE_IMAGE, the pin in .gitea/workflows/molecule.yml). Needs outbound network for the apt packages. The upstream # Pi-hole repository is replaced by a local stub whose installer only logs its arguments # (prepare.yml), so the scenario tests the role's own logic, not Pi-hole itself. # The containers run systemd as PID 1 with a writable cgroup; no privileged mode. @@ -23,21 +22,6 @@ platforms: - /run/lock security_opts: - apparmor=unconfined - - name: ${KAMINO_RUN_ID:-local}-pihole-resolute - labels: - net.rkdr.mortis.molecule-run: "${KAMINO_RUN_ID:-local}" - image: ${MOLECULE_IMAGE_2604} - pre_build_image: true - pull: true - command: /sbin/init - cgroupns_mode: host - volumes: - - /sys/fs/cgroup:/sys/fs/cgroup:rw - tmpfs: - - /run - - /run/lock - security_opts: - - apparmor=unconfined provisioner: name: ansible # One source for every play, so the converge and the negative tests in verify.yml start from