roles/rhel-network: Add static route support
This commit is contained in:
4
roles/rhel-network/templates/route-base.j2
Normal file
4
roles/rhel-network/templates/route-base.j2
Normal file
@@ -0,0 +1,4 @@
|
||||
{% macro ip_route(route, ifname) %}
|
||||
{% if route.type|d %}{{ route.type }} {% endif %}{{ route.prefix }}{% if route.metric is defined %} metric {{ route.metric }}{% endif %}{% if route.source|d %} src {{ route.source }}{% endif %}{% if route.nexthop|d %}{% for hop in route.nexthop %} {% if loop.length > 1 %}nexthop {% endif %}via {{ hop.address }} dev {{ ifname }}{% if loop.length > 1 and hop.weight is defined %} weight {{ hop.weight }}{% endif %}{% endfor %}{% else %} dev {{ ifname }}{% endif %}
|
||||
{% endmacro %}
|
||||
{% block routes %}{% endblock %}
|
||||
6
roles/rhel-network/templates/route.j2
Normal file
6
roles/rhel-network/templates/route.j2
Normal file
@@ -0,0 +1,6 @@
|
||||
{% extends "route-base.j2" %}
|
||||
{% block routes %}
|
||||
{% for route in item.routes|d([]) if ':' not in route.prefix %}
|
||||
{{ ip_route(route, item.ifname) }}
|
||||
{% endfor %}
|
||||
{% endblock routes %}
|
||||
6
roles/rhel-network/templates/route6.j2
Normal file
6
roles/rhel-network/templates/route6.j2
Normal file
@@ -0,0 +1,6 @@
|
||||
{% extends "route-base.j2" %}
|
||||
{% block routes %}
|
||||
{% for route in item.routes|d([]) if ':' in route.prefix %}
|
||||
{{ ip_route(route, item.ifname) }}
|
||||
{% endfor %}
|
||||
{% endblock routes %}
|
||||
Reference in New Issue
Block a user