--- # The role clones the upstream Pi-hole repository and runs its installer, which needs a real # DNS stack (pihole-FTL, port 53, the gravity database). A container cannot honestly test that, # so the clone target is a local git repository whose installer is a stub that logs its # arguments and creates the database file the role checks for an existing install. - name: Prepare hosts: all gather_facts: false tasks: - name: Install git ansible.builtin.apt: name: git state: present update_cache: true - name: Build the stub upstream repository ansible.builtin.shell: cmd: | set -e rm -rf /opt/pihole-stub /opt/pihole-stub.git /var/log/pihole-stub-installer.log mkdir -p "/opt/pihole-stub/automated install" cat > "/opt/pihole-stub/automated install/basic-install.sh" <<'STUB' #!/bin/sh echo "$*" >> /var/log/pihole-stub-installer.log mkdir -p /etc/pihole touch /etc/pihole/pihole-FTL.db STUB chmod 0755 "/opt/pihole-stub/automated install/basic-install.sh" cd /opt/pihole-stub git init -q -b main git -c user.name=molecule -c user.email=molecule@localhost add -A git -c user.name=molecule -c user.email=molecule@localhost commit -q -m stub git tag v6.4 git clone -q --bare /opt/pihole-stub /opt/pihole-stub.git executable: /bin/bash changed_when: true