From 5237db91a43e04bf7535056ccbd42edbe7f5d1f8 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Tue, 24 Sep 2024 22:37:01 +0200 Subject: ipam --- ansible/group_vars/all/ipam.yml | 13 +++++++------ ansible/plays/ipam-generate-dns.yml | 7 ++++++- ansible/plays/ipam-generate-tf.yml | 4 +++- 3 files changed, 16 insertions(+), 8 deletions(-) (limited to 'ansible') diff --git a/ansible/group_vars/all/ipam.yml b/ansible/group_vars/all/ipam.yml index 9954a21..ed41105 100644 --- a/ansible/group_vars/all/ipam.yml +++ b/ansible/group_vars/all/ipam.yml @@ -10,15 +10,16 @@ ipam6: range: "fdb1:4242:3538::/48" tnet_dn42: range: "fdb1:4242:3538:2000::/52" - conflatorio_dn42: - description: Internal network on host + unused_2001: range: "fdb1:4242:3538:2001::/64" - hosts: - conflatorio: "fdb1:4242:3538:2001::ffff/64" node1_dn42: range: "fdb1:4242:3538:2002::/64" + hosts: + node1: "fdb1:4242:3538:2002::/64" node2_dn42: range: "fdb1:4242:3538:2003::/64" + hosts: + node2: "fdb1:4242:3538:2003::/64" knot_dn42: range: "fdb1:4242:3538:2004::/64" hosts: @@ -34,8 +35,8 @@ ipam6: range: "fdb1:4242:3538:2006::/64" hosts: kv24ix: "fdb1:4242:3538:2006::ffff/64" - conflatorio_dn42_2: - range: "fdb1:4242:3538:2007:1001::/112" + unused_2007: + range: "fdb1:4242:3538:2007::/64" lhn2_dn42: range: "fdb1:4242:3538:2008::/64" hosts: diff --git a/ansible/plays/ipam-generate-dns.yml b/ansible/plays/ipam-generate-dns.yml index 7bdbfaa..d29b3e8 100644 --- a/ansible/plays/ipam-generate-dns.yml +++ b/ansible/plays/ipam-generate-dns.yml @@ -22,6 +22,11 @@ {% endfor %} - debug: msg: "{{ content }}" - - copy: + when: false + - name: Generating ../../terraform/dns/dn42.tf + register: tf + copy: dest: ../../terraform/dns/dn42.tf content: "{{ content }}" + - shell: terraform fmt ../../terraform/ipam6/ipam6.tf + when: "tf.changed" diff --git a/ansible/plays/ipam-generate-tf.yml b/ansible/plays/ipam-generate-tf.yml index f905b51..e43a559 100644 --- a/ansible/plays/ipam-generate-tf.yml +++ b/ansible/plays/ipam-generate-tf.yml @@ -1,6 +1,8 @@ - hosts: localhost gather_facts: no connection: local + collections: + - ansible.utils tasks: - name: Generate terraform/ipam6/ipam6.tf register: tf @@ -10,7 +12,7 @@ output "networks" { value = { {% for name, network in ipam6.networks.items() %} - {% if not (network.range | ipv6) %} + {% if not (network.range | ansible.utils.ipv6) %} Invalid network: {{ network.range }} {% endif %} {{ name }} = { -- cgit v1.2.3