ansible-role-networking/templates/systemd.network.j2

55 lines
1.4 KiB
Django/Jinja

#jinja2: lstrip_blocks: "True", trim_blocks: "True"
#
# {{ ansible_managed }}
#
{% if item.match_options is defined and item.match_options | length > 0 %}
[Match]
{% for match_option in item.match_options %}
{{ match_option.key }}={{ match_option.value }}
{% endfor %}
{% endif %}
{% if item.network_options is defined and item.network_options | length > 0 %}
[Network]
{% for network_option in item.network_options %}
{{ network_option.key }}={{ network_option.value }}
{% endfor %}
{% endif %}
{% if item.dhcp_options is defined and item.dhcp_options | length > 0 %}
[DHCP]
{% for dhcp_option in item.dhcp_options %}
{{ dhcp_option.key }}={{ dhcp_option.value }}
{% endfor %}
{% endif %}
{% if item.addresses is defined %}
{% for address in item.addresses %}
{% if address.options is defined and address.options | length > 0 %}
{% if address.name is defined and address.name | length > 0 %}
# {{ address.name }}
{% endif %}
[Address]
{% for option in address.options %}
{{ option.key }}={{ option.value }}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
{% if item.routes is defined %}
{% for route in item.routes %}
{% if route.options is defined and route.options | length > 0 %}
{% if route.name is defined and route.name | length > 0 %}
# {{ route.name }}
{% endif %}
[Route]
{% for option in route.options %}
{{ option.key }}={{ option.value }}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}