feat: add static routes

This commit is contained in:
Simon Cornet 2026-02-16 17:21:12 +01:00
commit 7939bb1b14
4 changed files with 37 additions and 4 deletions

View file

@ -5,3 +5,13 @@
ansible.builtin.service:
name: "iptables"
state: "restarted"
# apply local routes
- name: "apply routes"
ansible.builtin.shell:
cmd: |
{% for route in static_routes %}
ip route replace {{ route.destination }} via {{ route.gateway }}{{ ' dev ' + route.interface if route.interface is defined else '' }}
{% endfor %}
when: "static_routes | length > 0"
changed_when: false