fix(pihole): address review findings

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
This commit is contained in:
Defame1297 committed 2026-11-25 18:53:21 +00:00
1 parent 9979dfa8ed
commit d84fb4a2f4
7 files changed
+33 -38

No files matched your search

+10 -8
View File
@@ -27,8 +27,7 @@
dest: "{{ __pihole_effective.repo.path }}"
version: "{{ __pihole_version }}"
become: true
become_user: "{{ ansible_user_id }}"
register: __pihole_repo
become_user: "{{ ansible_facts['user_id'] }}"
# what happens if we run the install script with a pre-existing pihole on the system?
@@ -38,11 +37,9 @@
# on my machine the install script produced a never-ending output of "y" lines immediately after
# successfully restarting the pihole-FTL service (if output was printed to file it quickly
# filled the available disk space). Did this happen because Pi-Hole was already installed?
# Only on a first install: on an installed Pi-hole the role leaves upgrades alone.
- name: Run Pi-Hole installation script in unattended mode
when:
- (__pihole_repo.changed | bool) or (pihole_force_install | bool) or true
# but not if pihole is already installed, in that case let the updater do its job
- not (__pihole_installed | bool)
when: not (__pihole_installed | bool)
block:
# the unattended install only works if pihole.toml already exists (configure.yml)
@@ -65,11 +62,16 @@
ansible.builtin.slurp:
src: "{{ __pihole_effective.repo.path }}/pihole_install.log"
register: __pihole_install_log
when: pihole_testing | bool
# under --check the installer was skipped, so there is no log to read
when:
- pihole_testing | bool
- not ansible_check_mode
# https://www.shellhacks.com/ansible-cat-file-print-read-file-content
- name: Display the install log
ansible.builtin.debug:
msg: "{{ __pihole_install_log.content | b64decode }}"
when: pihole_testing | bool
when:
- pihole_testing | bool
- not ansible_check_mode
# END OF BLOCK