Create DNS entry.

This commit is contained in:
yohan 2024-10-06 23:26:24 +02:00
parent b3646b9df2
commit 9648366e8b
2 changed files with 22 additions and 0 deletions

View File

@ -126,3 +126,24 @@
immediate: true
state: enabled
become: true
- name: Create DNS entry
ansible.builtin.lineinfile:
path: "/var/lib/docker-latest/volumes/dockernamed_var_bind/_data/named.scimetis.net"
regexp: '^{{ SHORTNAME }}\s*IN'
line: "{{ SHORTNAME }} IN A {{ ansible_host }}"
register: dns_entry
become: true
vars:
ansible_ssh_port: "{{ SECRET_SSH_PORT }}"
remote_user: "{{ LINUX_USERNAME }}"
delegate_to: "{{ SECRET_HOST }}"
- name: Restart DNS container on SECRET_HOST
command: docker exec -it named /usr/sbin/rndc reload
become: true
vars:
ansible_ssh_port: "{{ SECRET_SSH_PORT }}"
remote_user: "{{ LINUX_USERNAME }}"
delegate_to: "{{ SECRET_HOST }}"
when: dns_entry is changed

View File

@ -1,4 +1,5 @@
---
SHORTNAME: "{{ target_name.split('.')[0] }}"
DOMAIN: "{{ target_name[target_name.index('.') + 1:] }}"
OS_IMAGE: Rocky Linux 9