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

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
This commit is contained in:
Defame1297 committed 2026-11-25 19:09:39 +00:00
1 parent d167cbefc5
commit 910d79768a
3 files changed
+4 -4

No files matched your search

+1 -1
View File
@@ -36,7 +36,7 @@ The upstreams default to `1.1.1.1` and `8.8.8.8`, `config.dns.domain` to `lan` a
## Tags
The input asserts carry `always` (and `assert`), so they run whatever tags are selected. The merge and the configuration-directory check, which only compute facts, carry `always` too, so skipping a tag never skips a fact a later task reads. The installed check (stat and fact) carries `updates-only`, and the reconfigure import carries `config-only`. The version fact, configuration and installation tasks carry no tag of their own, so they run only when no tags are selected.
The input asserts carry `always` (and `assert`), so they run whatever tags are selected. The merge, the installed check and the configuration-directory check, which only compute facts, carry `always` too, so skipping a tag never skips a fact a later task reads. The reconfigure import carries `config-only`. The version fact, configuration and installation tasks carry no tag of their own, so they run only when no tags are selected.
## Example play
+3 -2
View File
@@ -15,16 +15,17 @@
ansible.builtin.set_fact:
__pihole_version: "{{ __pihole_effective.repo.version }}"
# Fact-only, under always: the configuration and installation tasks read it.
- name: Check if Pi-Hole is already installed
ansible.builtin.stat:
path: "{{ __pihole_effective.config.files.database }}"
register: __pihole_database
tags: updates-only
tags: always
- name: Set Pi-Hole installation status
ansible.builtin.set_fact:
__pihole_installed: "{{ __pihole_database.stat.exists | default(false) }}"
tags: updates-only
tags: always
# Read by the template tasks: under --check the directory is not created, so on a first run
# there is no directory to render pihole.toml into. Under always, because one reader is
-1
View File
@@ -3,7 +3,6 @@
# "__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