pihole-dns
Ansible Role: sixteenone.pihole-dns
This role manages DNS and CNAME records for PiHole.
Requirements
- A running PiHole instance
- Ansible 2.9 or higher
Tasks
This role performs the following tasks:
- Creates DNS records in
/etc/pihole/custom.list
- Creates CNAME records in
/etc/dnsmasq.d/05-pihole-custom-cname.conf
- Restarts the FTL service when changes are made
Role Variables
Define your DNS and CNAME records in the following variables:
pihole_dns_dns:
- { ip: 192.168.1.100, domain: example.com }
pihole_dns_cname:
- { domain: www.example.com, target: example.com }
Example Playbook
Note: These files are created everytime, any original data that currently exists on your PiHole server will be lost, the Variables are the "source of truth"
It is easier to maintain if you put all of the DNS & CNAME's into an external file, in the format specified in the Role Variable section above. Then reference the file in your Playbook against the Role.
- name: Add DNS & CNAMES to PiHole Servers
hosts: pihole_servers
become: true
gather_facts: false
vars_files:
- dns.yml
roles:
- sixteenone.pihole-dns
License
MIT
Author Information
This Role was created by SixteenOne
Install
ansible-galaxy install SixteenOne/ansible-role-pihole-dns
License
mit
Downloads
9
Owner
Learning the world of Containers | IaC | K8s | Linux | Metrics