add gateways

This commit is contained in:
histausse 2021-07-08 00:43:58 +02:00
parent 199932a2fa
commit a567a9e27f
Signed by: histausse
GPG key ID: 67486F107F62E9E9
4 changed files with 5 additions and 9 deletions

View file

@ -1,11 +1,7 @@
---
interfaces:
enp0s3:
ipv4: 10.0.2.6
netmaskv4: 24
type: static
routes:
- {subnet: 0.0.0.0, netmask: 0, gateway: 10.0.2.1}
type: dhcp
wg0:
ipv4: "{{ intranet.subnets.test.subnets.vm2.ipv4 }}"
netmaskv4: "{{ intranet.netmaskv4 }}"

View file

@ -4,8 +4,7 @@ interfaces:
ipv4: 10.0.2.7
netmaskv4: 24
type: static
routes:
- {subnet: 0.0.0.0, netmask: 0, gateway: 10.0.2.1}
gateway: 10.0.2.1
wg0:
ipv4: "{{ intranet.subnets.test.subnets.vm3.ipv4 }}"
netmaskv4: "{{ intranet.netmaskv4 }}"

View file

@ -5,8 +5,6 @@ interfaces:
netmaskv4: 24
type: static
gateway: 10.0.2.1
# routes:
# - {subnet: 0.0.0.0, netmask: 0, gateway: 10.0.2.1}
wg0:
ipv4: "{{ intranet.subnets.test.subnets.vm4.ipv4 }}"
netmaskv4: "{{ intranet.netmaskv4 }}"

View file

@ -20,6 +20,9 @@ iface {{ item.key }} inet static
{% if 'ipv4' in item.value %}
address {{ item.value.ipv4 }}/{{ item.value.netmaskv4 }}
{% endif %}
{% if 'gateway' in item.value %}
gateway {{ item.value.gateway }}
{% endif %}
{% if 'routes' in item.value %}{# route dw #}
{% for route in item.value.routes %}
post-down ip route del {{ route.subnet }}/{{ route.netmask }} via {{ route.gateway }}