fix(pihole): run every fact-only task whatever tags are skipped
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:
1 parent
d167cbefc5
commit
910d79768a
3 files changed
+4
-4
No files matched your search
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user