diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2024-09-20 20:59:00 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2024-09-20 21:00:11 +0200 |
commit | f64d2870fa503b050cad8caefee5b27a3c55da8d (patch) | |
tree | 63be146d2d0eeb83a1adf8b2fc21e0dba374324e /ansible | |
parent | 7ad2c810f6743a12a75ada1751bd098960db6846 (diff) | |
download | infra-f64d2870fa503b050cad8caefee5b27a3c55da8d.tar.gz infra-f64d2870fa503b050cad8caefee5b27a3c55da8d.tar.bz2 infra-f64d2870fa503b050cad8caefee5b27a3c55da8d.tar.xz infra-f64d2870fa503b050cad8caefee5b27a3c55da8d.zip |
dn42.trygvis.io
Diffstat (limited to 'ansible')
-rw-r--r-- | ansible/group_vars/all/ipam.yml | 1 | ||||
-rw-r--r-- | ansible/plays/ipam-generate-dns.yml | 27 |
2 files changed, 28 insertions, 0 deletions
diff --git a/ansible/group_vars/all/ipam.yml b/ansible/group_vars/all/ipam.yml index 6c61600..991bf81 100644 --- a/ansible/group_vars/all/ipam.yml +++ b/ansible/group_vars/all/ipam.yml @@ -42,6 +42,7 @@ ipam6: range: "fdb1:4242:3538:2008::/64" hosts: lhn2pi: "fdb1:4242:3538:2008::ffff/64" + conflatorio: "fdb1:4242:3538:2008:8042:32ff:fe0c:7161" dn42: range: "fd00::/8" 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 }}" |