Remove the pihole_force_install input, which had no effect, and the dead term of the install condition. Tag the merge and the configuration directory check always, so --skip-tags config-only no longer skips facts that later tasks read. Skip the installer log under --check, where the installer did not run. Read the env and user_id facts through ansible_facts, drop a redundant default, state the real reasons two defaults stay out of the argument spec, and bring the README to the fixed heading set. Assisted-by: Claude Code:claude-opus-5-5
47 lines
1.5 KiB
YAML
47 lines
1.5 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 }}"
|
|
|
|
- name: Check if Pi-Hole is already installed
|
|
ansible.builtin.stat:
|
|
path: "{{ __pihole_effective.config.files.database }}"
|
|
register: __pihole_database
|
|
tags: updates-only
|
|
|
|
- name: Set Pi-Hole installation status
|
|
ansible.builtin.set_fact:
|
|
__pihole_installed: "{{ __pihole_database.stat.exists | default(false) }}"
|
|
tags: updates-only
|
|
|
|
# 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
|