ansible-role-networking/templates/systemd.netdev.j2
Markus Pesch ef98355d71
All checks were successful
continuous-integration/drone/push Build is passing
feat: support multiple routes and addresses, support wireguard
2022-04-18 16:35:41 +02:00

47 lines
1.3 KiB
Django/Jinja

#jinja2: lstrip_blocks: "True", trim_blocks: "True"
#
# {{ ansible_managed }}
#
{% if item.netdev_options is defined and item.netdev_options | length > 0 %}
[NetDev]
{% for netdev_option in item.netdev_options %}
{{ netdev_option.key }}={{ netdev_option.value }}
{% endfor %}
{% endif %}
{% if item.bond_options is defined and item.bond_options | length > 0 %}
[Bond]
{% for bond_option in item.bond_options %}
{{ bond_option.key }}={{ bond_option.value }}
{% endfor %}
{% endif %}
{% if item.bridge_options is defined and item.bridge_options | length > 0 %}
[Bridge]
{% for bridge_option in item.bridge_options %}
{{ bridge_option.key }}={{ bridge_option.value }}
{% endfor %}
{% endif %}
{% if item.wireguard_options is defined and item.wireguard_options | length > 0 %}
[WireGuard]
{% for wireguard_option in item.wireguard_options %}
{{ wireguard_option.key }}={{ wireguard_option.value }}
{% endfor %}
{% endif %}
{% if item.wireguard_peers is defined %}
{% for wireguard_peer in item.wireguard_peers %}
{% if wireguard_peer.options is defined and wireguard_peer.options | length > 0 %}
{% if wireguard_peer.name is defined and wireguard_peer.name | length > 0 %}
# {{ wireguard_peer.name }}
{% endif %}
[WireGuardPeer]
{% for option in wireguard_peer.options %}
{{ option.key }}={{ option.value }}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}