47 lines
1.6 KiB
YAML
47 lines
1.6 KiB
YAML
---
|
|
- name: Configure Pi-hole v6 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: Copy DNS update script
|
|
ansible.builtin.template:
|
|
src: ../templates/pihole-hosts.py.j2
|
|
dest: /tmp/update_pihole_hosts.py
|
|
mode: '0755'
|
|
|
|
- name: Update Pi-hole DNS hosts
|
|
ansible.builtin.command: python3 /tmp/update_pihole_hosts.py
|
|
register: update_result
|
|
changed_when: "'updated' in update_result.stdout.lower()"
|
|
notify: Restart pihole-FTL
|
|
|
|
- name: Cleanup script
|
|
ansible.builtin.file:
|
|
path: /tmp/update_pihole_hosts.py
|
|
state: absent
|
|
|
|
handlers:
|
|
- name: Restart pihole-FTL
|
|
ansible.builtin.systemd:
|
|
name: pihole-FTL
|
|
state: restarted
|