feat: remove static routes
This commit is contained in:
parent
55395d537b
commit
407a01550a
4 changed files with 0 additions and 52 deletions
|
|
@ -34,23 +34,3 @@
|
|||
value: "0"
|
||||
- name: "net.ipv4.conf.all.log_martians"
|
||||
value: "0"
|
||||
|
||||
# configure static routes
|
||||
- name: "routing - static routes"
|
||||
ansible.builtin.blockinfile:
|
||||
path: "/etc/network/interfaces"
|
||||
marker: " # {mark} ANSIBLE MANAGED STATIC ROUTES"
|
||||
block: |
|
||||
{% for route in static_routes %}
|
||||
# {{ route.name }}
|
||||
{% if route.metric is defined %}
|
||||
down ip route del {{ route.destination }} via {{ route.gateway }}{{ ' dev ' + route.interface if route.interface is defined else '' }} metric {{ route.metric }}
|
||||
up ip route add {{ route.destination }} via {{ route.gateway }}{{ ' dev ' + route.interface if route.interface is defined else '' }} metric {{ route.metric }}
|
||||
{% else %}
|
||||
down ip route del {{ route.destination }} via {{ route.gateway }}{{ ' dev ' + route.interface if route.interface is defined else '' }}
|
||||
up ip route add {{ route.destination }} via {{ route.gateway }}{{ ' dev ' + route.interface if route.interface is defined else '' }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
insertafter: "^iface {{ lan_interface }} inet.*\\n(\\s+.*\\n)*\\s+netmask"
|
||||
state: "{{ 'present' if static_routes | length > 0 else 'absent' }}"
|
||||
notify: "apply routes"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue