--- # 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] - name: Merge configuration defaults ansible.builtin.import_tasks: merge-defaults.yml tags: - default - backups-only - config-only - updates-only - 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. - name: Check whether the Pi-Hole configuration directory exists ansible.builtin.stat: path: "{{ __pihole_effective.config.files.database | dirname }}" register: __pihole_config_dir tags: config-only - 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