diff options
-rw-r--r-- | ansible/group_vars/all/ipam.yml | 1 | ||||
-rw-r--r-- | ansible/plays/ipam-generate-dns.yml | 27 | ||||
-rw-r--r-- | bin/requirements.txt | 1 | ||||
-rw-r--r-- | terraform/dns/dn42.tf | 50 |
4 files changed, 79 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 }}" diff --git a/bin/requirements.txt b/bin/requirements.txt index 26faaf7..cb4fdce 100644 --- a/bin/requirements.txt +++ b/bin/requirements.txt @@ -1,2 +1,3 @@ ansible==10.3.0 gns3fy==0.8.0 +netaddr==1.3.0 diff --git a/terraform/dns/dn42.tf b/terraform/dns/dn42.tf new file mode 100644 index 0000000..52a2628 --- /dev/null +++ b/terraform/dns/dn42.tf @@ -0,0 +1,50 @@ +# Generated from ansible data + +resource "linode_domain_record" "dn42-conflatorio" { + domain_id = linode_domain.root.id + name = "conflatorio.dn42" + record_type = "AAAA" + target = "fdb1:4242:3538:2008:8042:32ff:fe0c:7161" +} + +resource "linode_domain_record" "dn42-conflatorio-ix" { + domain_id = linode_domain.root.id + name = "conflatorio-ix.dn42" + record_type = "AAAA" + target = "fdb1:4242:3538:2001::ffff" +} + +resource "linode_domain_record" "dn42-coregonus-ix" { + domain_id = linode_domain.root.id + name = "coregonus-ix.dn42" + record_type = "AAAA" + target = "fdb1:4242:3538:2005::ffff" +} + +resource "linode_domain_record" "dn42-danneri" { + domain_id = linode_domain.root.id + name = "danneri.dn42" + record_type = "AAAA" + target = "fdb1:4242:3538:2005:9422:d355:95b7:f170" +} + +resource "linode_domain_record" "dn42-knot" { + domain_id = linode_domain.root.id + name = "knot.dn42" + record_type = "AAAA" + target = "fdb1:4242:3538:2004::ffff" +} + +resource "linode_domain_record" "dn42-kv24ix" { + domain_id = linode_domain.root.id + name = "kv24ix.dn42" + record_type = "AAAA" + target = "fdb1:4242:3538:2006::ffff" +} + +resource "linode_domain_record" "dn42-lhn2pi" { + domain_id = linode_domain.root.id + name = "lhn2pi.dn42" + record_type = "AAAA" + target = "fdb1:4242:3538:2008::ffff" +} |