feat(pihole): add the pihole role #372

Merged
Defame1297 merged 10 commits from feat/pihole-role into main 2026-11-25 19:37:22 +00:00
3 changed files with 4 additions and 4 deletions
Showing only changes of commit 910d79768a - Show all commits

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