Files
Kamino/roles/pihole/tasks/main.yml
T
Defame1297 910d79768a
Build / build (pull_request) Successful in 27s
Molecule / molecule (pull_request) Failing after 1m2s
Lint / lint (pull_request) Successful in 1m52s
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
2026-11-25 19:09:39 +00:00

48 lines
1.6 KiB
YAML

---
# Validation first, under always, so a bad input fails before any change whatever tags the
# run selects.
- name: Validate the role inputs
ansible.builtin.import_tasks: validate.yml
tags: [always, assert]
# Fact-only, under always: every later task reads the merged settings, so skipping a tag
# must not skip the merge.
- name: Merge configuration defaults
ansible.builtin.import_tasks: merge-defaults.yml
tags: always
- name: Set Pi-Hole version variable
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: always
- name: Set Pi-Hole installation status
ansible.builtin.set_fact:
__pihole_installed: "{{ __pihole_database.stat.exists | default(false) }}"
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
# untagged and the other tagged config-only.
- name: Check whether the Pi-Hole configuration directory exists
ansible.builtin.stat:
path: "{{ __pihole_effective.config.files.database | dirname }}"
register: __pihole_config_dir
tags: always
- name: Configure Pi-Hole
ansible.builtin.import_tasks: configure.yml
- name: Install Pi-Hole
ansible.builtin.import_tasks: install.yml
- name: Reconfigure Pi-Hole
ansible.builtin.import_tasks: reconfigure.yml
tags: config-only