zfuller.pihole
Pi-hole Raspberry Pi Ansible Role
This role installs and sets up Pi-hole (https://pi-hole.net/) automatically.
For more information about Pi-hole, visit https://docs.pi-hole.net/.
Requirements
You need a user with sudo access to the machine.
Please check other prerequisites.
Required Variables
pihole_setupvars_webpassword
You need to create an admin password for the pihole_setupvars_webpassword
variable. The password will be hashed using sha256 twice. You can generate a password using this shell command.
With the password in a file (recommended):
echo -n $(cat ~/piholepass.word) | sha256sum | awk '{printf "%s", $1}' | sha256sum
With the password in a shell command (not recommended):
echo -n notsosecretpassword | sha256sum | awk '{printf "%s", $1}' | sha256sum
It's recommended to store this variable in an Ansible vault.
pihole_setupvars_ipv4_address
Enter the IPv4 address for the Pi-hole.
pihole_setupvars_pihole_dns_1/2
Specify the DNS servers you want Pi-hole to use.
DNS
Here are some alternative DNS Providers:
Google: https://developers.google.com/speed/public-dns
- 8.8.8.8
- 8.8.4.4
OpenDNS: https://use.opendns.com/
- 208.67.222.222
- 208.67.220.220
Cloudflare: https://1.1.1.1/dns/
- 1.1.1.1
- 1.0.0.1
Role Variables
For default values, see defaults/main.yml.
Example Playbook
Here's an example playbook:
---
- name: pihole
hosts: pi
strategy: free
become_method: sudo
become: yes
gather_facts: yes
vars:
pihole_setupvars_ipv4_address: 192.168.1.100
pihole_setupvars_webpassword: 35030714f1136486a612d7014b739a6c7ef3be589bb14b14a3d01f521dd7ef18
pihole_setupvars_pihole_dns_1: 1.1.1.1
pihole_setupvars_pihole_dns_2: 1.0.0.1
roles:
- zfuller.pihole
Simple role to install and configure pihole on a raspberry pi
ansible-galaxy install zfuller.pihole