From 5f1e30430189787004c0fd10b87180bb8f6e3249 Mon Sep 17 00:00:00 2001 From: michael Date: Wed, 9 Aug 2023 22:55:51 +1000 Subject: [PATCH] jinja whitespace --- .../hv00_balsillie_house.yaml | 10 +++++++ ansible/playbooks/templates/vlan.network.j2 | 27 ++++++++++--------- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/ansible/inventory/host_vars/hv00_balsillie_home/hv00_balsillie_house.yaml b/ansible/inventory/host_vars/hv00_balsillie_home/hv00_balsillie_house.yaml index e47ea59..581a877 100644 --- a/ansible/inventory/host_vars/hv00_balsillie_home/hv00_balsillie_house.yaml +++ b/ansible/inventory/host_vars/hv00_balsillie_home/hv00_balsillie_house.yaml @@ -21,6 +21,16 @@ systemd_networkd_configs: src: vlan.netdev.j2 - name: vlan110.network src: vlan.network.j2 + address: + ipv4: 10.192.110.1/24 + ipv6: + gateway: + ipv4: 10.192.110.254 + ipv6: + nameserver: + ipv4: + 10.192.110.254 + ipv6: qemu_bridges: br0 diff --git a/ansible/playbooks/templates/vlan.network.j2 b/ansible/playbooks/templates/vlan.network.j2 index b71dac4..89b6a56 100644 --- a/ansible/playbooks/templates/vlan.network.j2 +++ b/ansible/playbooks/templates/vlan.network.j2 @@ -5,26 +5,27 @@ Name={{ item.name | regex_replace('^[0-9]*-', '') | regex_replace('\.netdev', ' ARP={{ item.arp }} [Network] -{% if item.nameserver.ipv4 is defined %} -{% for nameserver in item.nameserver.ipv4 %} +{% if item.nameserver.ipv4 is defined -%} +{% for nameserver in item.nameserver.ipv4 -%} DNS={{ nameserver }} -{% endfor %} -{% endif %} -{% if item.nameserver.ipv6 is defined %} -{% for nameserver in item.nameserver.ipv6 %} +{% endfor -%} +{% endif -%} +{% if item.nameserver.ipv6 is defined -%} +{% for nameserver in item.nameserver.ipv6 -%} DNS={{ nameserver }} -{% endfor %} -{% endif %} +{% endfor -%} +{% endif -%} {% if item.address.ipv4 is defined %} [Address] Address={{ item.address.ipv4 }} -{% endif %} +{% endif -%} {% if item.address.ipv6 is defined %} [Address] Address={{ item.address.ipv6 }} -{% endif %} +{% endif -%} + {% if item.gateway.ipv4 is defined %} [Route] @@ -33,12 +34,12 @@ Gateway={{ item.gateway.ipv4 }} Scope=global Protocol=static Type=unicast -{% endif %} +{% endif -%} {% if item.gateway.ipv6 is defined %} [Route] Destination=::/0 -Gateway={{ item.gateway.ipv4 }} +Gateway={{ item.gateway.ipv6 }} Protocol=static Type=unicast -{% endif %} \ No newline at end of file +{% endif -%} \ No newline at end of file