Liberalize static_route defenition
At the moment a very limited amount of options are supported for static_routes defenition, which might be a limiting factor in some more complex solutions. It is proposed to let operators define `static_routes` with parameters that are available in systemd-networkd [1] directly, which should provide required flexbility and not require us additional maintenance and regular updates of the code. [1] https://www.freedesktop.org/software/systemd/man/latest/systemd.network.html#%5BRoute%5D%20Section%20Options Change-Id: I71f81cb497ae8eeb0fab2bc6f9f5eae120d10775
This commit is contained in:
parent
dcc83c2448
commit
852739df6d
@ -64,8 +64,8 @@ Release notes for the project can be found at:
|
|||||||
mtu: 9000
|
mtu: 9000
|
||||||
usedns: true
|
usedns: true
|
||||||
static_routes:
|
static_routes:
|
||||||
- gateway: "10.1.0.1"
|
- Gateway: "10.1.0.1"
|
||||||
cidr: "10.1.0.0/24"
|
Destination: "10.1.0.0/24"
|
||||||
config_overrides:
|
config_overrides:
|
||||||
Network:
|
Network:
|
||||||
ConfigureWithoutCarrier: true
|
ConfigureWithoutCarrier: true
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Keys for ``static_routes`` were liberalized and now can accept any
|
||||||
|
parameter supported by ``[Route]`` section of systemd-networkd.
|
||||||
|
upgrade:
|
||||||
|
- |
|
||||||
|
Following keys for ``static_routes`` list were renamed in order to
|
||||||
|
match with options available in systemd-networkd configuration files:
|
||||||
|
|
||||||
|
- ``cidr`` -> ``Destination``
|
||||||
|
- ``gateway`` -> ``Gateway``
|
||||||
|
|
||||||
|
While backwards compatability was kept, it's highly recommended to
|
||||||
|
use new keys as support for old key names will be removed in the future.
|
@ -1,9 +1,18 @@
|
|||||||
# {{ ansible_managed }}
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
{% for route in item['static_routes'] %}
|
{% for route in item['static_routes'] %}
|
||||||
[Route]
|
{% set route_keys = route.keys() %}
|
||||||
Destination={{ route['cidr'] }}
|
{% if 'cidr' in route_keys %}
|
||||||
Gateway={{ route['gateway'] }}
|
{% set _ = route.update({'Destination': route.pop('cidr')}) %}
|
||||||
Metric={{ 20 + loop.index }}
|
{% endif %}
|
||||||
|
{% if 'gateway' in route_keys %}
|
||||||
|
{% set _ = route.update({'Gateway': route.pop('gateway')}) %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
[Route]
|
||||||
|
{% for key, value in route.items() %}
|
||||||
|
{{ key }}={{ value }}
|
||||||
|
{% endfor %}
|
||||||
|
{% if 'Metric' not in route_keys %}
|
||||||
|
Metric={{ 20 + loop.index }}
|
||||||
|
{% endif%}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -74,7 +74,7 @@
|
|||||||
mtu: 9000
|
mtu: 9000
|
||||||
usedns: true
|
usedns: true
|
||||||
static_routes:
|
static_routes:
|
||||||
- gateway: "10.1.0.1"
|
- Gateway: "10.1.0.1"
|
||||||
cidr: "10.1.0.0/24"
|
cidr: "10.1.0.0/24"
|
||||||
config_overrides:
|
config_overrides:
|
||||||
Network:
|
Network:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user