aboutsummaryrefslogtreecommitdiff
path: root/ansible
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2024-09-24 22:37:01 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2024-09-24 22:37:01 +0200
commit5237db91a43e04bf7535056ccbd42edbe7f5d1f8 (patch)
treed6bc7c18b754dc965a90300c731ace3b9f7e784f /ansible
parent61817c6a3a07aadd5608939ba8dded4a1e77c7ae (diff)
downloadinfra-5237db91a43e04bf7535056ccbd42edbe7f5d1f8.tar.gz
infra-5237db91a43e04bf7535056ccbd42edbe7f5d1f8.tar.bz2
infra-5237db91a43e04bf7535056ccbd42edbe7f5d1f8.tar.xz
infra-5237db91a43e04bf7535056ccbd42edbe7f5d1f8.zip
Diffstat (limited to 'ansible')
-rw-r--r--ansible/group_vars/all/ipam.yml13
-rw-r--r--ansible/plays/ipam-generate-dns.yml7
-rw-r--r--ansible/plays/ipam-generate-tf.yml4
3 files changed, 16 insertions, 8 deletions
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 }} = {