From f64d2870fa503b050cad8caefee5b27a3c55da8d Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Fri, 20 Sep 2024 20:59:00 +0200 Subject: dn42.trygvis.io --- ansible/plays/ipam-generate-dns.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 ansible/plays/ipam-generate-dns.yml (limited to 'ansible/plays') diff --git a/ansible/plays/ipam-generate-dns.yml b/ansible/plays/ipam-generate-dns.yml new file mode 100644 index 0000000..7bdbfaa --- /dev/null +++ b/ansible/plays/ipam-generate-dns.yml @@ -0,0 +1,27 @@ +- hosts: localhost + gather_facts: no + connection: local + tasks: + - set_fact: + content: | + {% set hosts = [] %} + {% for nw_name, network in ipam6.networks.items() %} + {% for host, address in (network.hosts|default({})).items() %} + {{- hosts.append({'name': host, 'address': address}) -}} + {% endfor %} + {% endfor %} + # Generated from ansible data + {% for h in hosts|sort(attribute='name') %} + + resource "linode_domain_record" "dn42-{{ h.name }}" { + domain_id = linode_domain.root.id + name = "{{ h.name }}.dn42" + record_type = "AAAA" + target = "{{ h.address|ansible.utils.ipv6('address') }}" + } + {% endfor %} + - debug: + msg: "{{ content }}" + - copy: + dest: ../../terraform/dns/dn42.tf + content: "{{ content }}" -- cgit v1.2.3