Add Pi-hole DNS management playbook
- playbooks/pihole-dns.yml: Configure local DNS records - templates/pihole-custom-list.j2: DNS records template Domain: lab.directlx.dev Records for all infrastructure hosts with short and FQDN names. Usage: ansible-playbook playbooks/pihole-dns.yml Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
9576810dad
commit
c4bdaa0e57
|
|
@ -0,0 +1,37 @@
|
||||||
|
---
|
||||||
|
- name: Configure Pi-hole local DNS records
|
||||||
|
hosts: pihole
|
||||||
|
vars:
|
||||||
|
dns_domain: lab.directlx.dev
|
||||||
|
dns_records:
|
||||||
|
- { ip: "192.168.200.106", hostname: "ansible-node" }
|
||||||
|
- { ip: "192.168.200.10", hostname: "proxmox-00" }
|
||||||
|
- { ip: "192.168.200.11", hostname: "proxmox-01" }
|
||||||
|
- { ip: "192.168.200.12", hostname: "proxmox-02" }
|
||||||
|
- { ip: "192.168.200.103", hostname: "postgres" }
|
||||||
|
- { ip: "192.168.200.110", hostname: "mysql" }
|
||||||
|
- { ip: "192.168.200.111", hostname: "mongo" }
|
||||||
|
- { ip: "192.168.200.65", hostname: "nginx" }
|
||||||
|
- { ip: "192.168.200.71", hostname: "npm" }
|
||||||
|
- { ip: "192.168.200.200", hostname: "docker" }
|
||||||
|
- { ip: "192.168.200.100", hostname: "pihole" }
|
||||||
|
- { ip: "192.168.200.102", hostname: "gitea" }
|
||||||
|
- { ip: "192.168.200.91", hostname: "jenkins" }
|
||||||
|
- { ip: "192.168.200.112", hostname: "hiveops" }
|
||||||
|
- { ip: "192.168.200.114", hostname: "smartjournal" }
|
||||||
|
- { ip: "192.168.200.61", hostname: "odoo" }
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Create Pi-hole custom DNS records
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: ../templates/pihole-custom-list.j2
|
||||||
|
dest: /etc/pihole/custom.list
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: '0644'
|
||||||
|
notify: Restart pihole dns
|
||||||
|
|
||||||
|
handlers:
|
||||||
|
- name: Restart pihole dns
|
||||||
|
ansible.builtin.command: pihole restartdns
|
||||||
|
changed_when: true
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
# Pi-hole local DNS records
|
||||||
|
# Managed by Ansible - do not edit manually
|
||||||
|
# Domain: {{ dns_domain }}
|
||||||
|
|
||||||
|
{% for record in dns_records %}
|
||||||
|
{{ record.ip }} {{ record.hostname }}.{{ dns_domain }} {{ record.hostname }}
|
||||||
|
{% endfor %}
|
||||||
Loading…
Reference in New Issue