Skip to content

Commit 2c4c82b

Browse files
authored
Merge pull request #325 from axldd/add-netplan-routes
Add custom routes
2 parents 405966f + 147bf53 commit 2c4c82b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

roles/netplan/templates/config.yaml.j2

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,21 @@ network:
2222
routes:
2323
- to: "default"
2424
via: "{{ ethernet['gateway4'] }}"
25+
{% if ethernet['routes'] is defined %}
26+
{% for route in ethernet['routes']%}
27+
- to: "{{ route.to }}"
28+
via: "{{ route.via }}"
29+
{% endfor %}
30+
{% endif %}
31+
{% endif %}
32+
{% if ethernet['gateway4'] is not defined %}
33+
{% if ethernet['routes'] is defined %}
34+
routes:
35+
{% for route in ethernet['routes']%}
36+
- to: "{{ route.to }}"
37+
via: "{{ route.via }}"
38+
{% endfor %}
39+
{% endif %}
2540
{% endif %}
2641
{% if ethernet['addresses'] is defined %}
2742
addresses:

0 commit comments

Comments
 (0)