router/handlers/main.yaml

18 lines
469 B
YAML

---
# restart nftables
- name: "restart nftables"
ansible.builtin.service:
name: "nftables"
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 }}
{% if route.interface is defined %}dev {{ route.interface }}{% endif %}
{% endfor %}
when: "static_routes | length > 0"
changed_when: false