ansible / ansible.builtin / v2.5.12 / module / net_static_route Manage static IP routes on network appliances (routers, switches et. al.) | "added in version" 2.4 of ansible.builtin" Authors: Ricardo Carrillo Cruz (@rcarrillocruz) preview | supported by networkansible.builtin.net_static_route (v2.5.12) — module
pip
Install with pip install ansible==2.5.12
This module provides declarative management of static IP routes on network appliances (routers, switches et. al.).
- name: configure static route net_static_route: prefix: 192.168.2.0 mask: 255.255.255.0 next_hop: 10.0.0.1
- name: remove configuration net_static_route: prefix: 192.168.2.0 mask: 255.255.255.0 next_hop: 10.0.0.1 state: absent
- name: configure aggregates of static routes net_static_route: aggregate: - { prefix: 192.168.2.0, mask 255.255.255.0, next_hop: 10.0.0.1 } - { prefix: 192.168.3.0, mask 255.255.255.0, next_hop: 10.0.2.1 }
- name: Remove static route collections net_static_route: aggregate: - { prefix: 172.24.1.0/24, next_hop: 192.168.42.64 } - { prefix: 172.24.3.0/24, next_hop: 192.168.42.64 } state: absent
mask: description: - Network prefix mask of the static route. required: true purge: default: false description: - Purge static routes not defined in the I(aggregate) parameter. state: choices: - present - absent default: present description: - State of the static route configuration. prefix: description: - Network prefix of the static route. required: true next_hop: description: - Next hop IP of the static route. required: true aggregate: description: List of static route definitions admin_distance: description: - Admin distance of the static route.
commands: description: The list of configuration mode commands to send to the device returned: always sample: - ip route 192.168.2.0/24 10.0.0.1 type: list