refactor: move shared Ansible tasks to ansible/tasks/
This commit is contained in:
20
ansible/tasks/add_technitium_dns_entry.yml
Normal file
20
ansible/tasks/add_technitium_dns_entry.yml
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
# Reusable task file for adding Technitium DNS entries
|
||||
# This replaces the standalone playbook and can be imported into any playbook
|
||||
|
||||
# - name: Display cluster_name
|
||||
# ansible.builtin.debug:
|
||||
# msg: "{{ host_name }} - {{ ip_address }} - {{ vault_technitium_api_key }}"
|
||||
|
||||
- name: Create DNS A Record entry for {{ host_name }}
|
||||
delegate_to: localhost
|
||||
effectivelywild.technitium_dns.technitium_dns_add_record:
|
||||
api_url: "http://{{ dns_server }}.{{ base_domain }}"
|
||||
api_token: "{{ vault_technitium_api_key }}"
|
||||
zone: "{{ base_domain }}"
|
||||
name: "{{ host_name }}.{{ base_domain }}"
|
||||
type: "A"
|
||||
ipAddress: "{{ ip_address }}"
|
||||
ptr: true
|
||||
ttl: 360
|
||||
validate_certs: false
|
||||
10
ansible/tasks/configure_dhcp_entry.yml
Normal file
10
ansible/tasks/configure_dhcp_entry.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
- name: Add DHCP entry for {{ inventory_hostname }}
|
||||
delegate_to: "{{ dhcp_server }}"
|
||||
become: true
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/dnsmasq.d/hosts.conf
|
||||
regexp: "# {{ inventory_hostname }}$"
|
||||
line: "dhcp-host={{ host_mac_address | lower }},{{ host_ip_address }} # {{ inventory_hostname }}"
|
||||
state: present
|
||||
notify: Restart dnsmasq
|
||||
11
ansible/tasks/create_dns_record.yml
Normal file
11
ansible/tasks/create_dns_record.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
- name: "Create DNS record for {{ dns_name | default(inventory_hostname) }}"
|
||||
delegate_to: "{{ dns_server }}"
|
||||
freeipa.ansible_freeipa.ipadnsrecord:
|
||||
ipaapi_context: "server"
|
||||
ipaadmin_password: "{{ vault_freeipa_password }}"
|
||||
name: "{{ dns_name | default(inventory_hostname) }}"
|
||||
zone_name: "{{ base_domain }}"
|
||||
record_type: "A"
|
||||
record_value: "{{ dns_address | default(host_ip_address) }}"
|
||||
record_ttl: 60
|
||||
Reference in New Issue
Block a user