ansible-role-pihole

Installs Pi-hole using the official unattended installer. A setupVars.conf is written before the installer runs so no interactive prompts appear.

The installer creates its own system users and manages its own services.

Requirements

  • Ansible >= 2.14
  • Debian or Ubuntu
  • A static IP address on the target host

Role Variables

Variable Default Description
pihole_interface {{ ansible_default_ipv4.interface }} Network interface
pihole_ipv4_address {{ ansible_default_ipv4.address }}/{{ ansible_default_ipv4.prefix }} IP/CIDR
pihole_dns_1 8.8.8.8 Primary upstream DNS
pihole_dns_2 8.8.4.4 Secondary upstream DNS
pihole_query_logging "true" Enable query logging
pihole_install_web_server "true" Install lighttpd web server
pihole_install_web_interface "true" Install web admin interface
pihole_lighttpd_enabled "true" Enable lighttpd
pihole_cache_size 10000 DNS cache size

Example Playbook

- hosts: dns_servers
  roles:
    - role: ansible-role-pihole
      vars:
        pihole_dns_1: 1.1.1.1
        pihole_dns_2: 1.0.0.1

License

MIT

Description
Install Pi-hole via the official unattended installer
Readme 28 KiB