2017-06-29 10:05:20 +00:00
|
|
|
---
|
|
|
|
- name: create static route
|
|
|
|
ios_static_route:
|
|
|
|
prefix: 172.16.31.0
|
|
|
|
mask: 255.255.255.0
|
|
|
|
next_hop: 10.0.0.8
|
|
|
|
state: present
|
|
|
|
authorize: yes
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- 'result.commands == ["ip route 172.16.31.0 255.255.255.0 10.0.0.8 1"]'
|
|
|
|
|
|
|
|
- name: create static route again (idempotent)
|
|
|
|
ios_static_route:
|
|
|
|
prefix: 172.16.31.0
|
|
|
|
mask: 255.255.255.0
|
|
|
|
next_hop: 10.0.0.8
|
|
|
|
state: present
|
|
|
|
authorize: yes
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == false'
|
|
|
|
|
|
|
|
- name: modify admin distance of static route
|
|
|
|
ios_static_route:
|
|
|
|
prefix: 172.16.31.0
|
|
|
|
mask: 255.255.255.0
|
|
|
|
next_hop: 10.0.0.8
|
|
|
|
admin_distance: 2
|
|
|
|
state: present
|
|
|
|
authorize: yes
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- 'result.commands == ["ip route 172.16.31.0 255.255.255.0 10.0.0.8 2"]'
|
|
|
|
|
|
|
|
- name: modify admin distance of static route again (idempotent)
|
|
|
|
ios_static_route:
|
|
|
|
prefix: 172.16.31.0
|
|
|
|
mask: 255.255.255.0
|
|
|
|
next_hop: 10.0.0.8
|
|
|
|
admin_distance: 2
|
|
|
|
state: present
|
|
|
|
authorize: yes
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == false'
|
|
|
|
|
|
|
|
- name: delete static route
|
|
|
|
ios_static_route:
|
|
|
|
prefix: 172.16.31.0
|
|
|
|
mask: 255.255.255.0
|
|
|
|
next_hop: 10.0.0.8
|
|
|
|
admin_distance: 2
|
|
|
|
state: absent
|
|
|
|
authorize: yes
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- 'result.commands == ["no ip route 172.16.31.0 255.255.255.0 10.0.0.8"]'
|
|
|
|
|
|
|
|
- name: delete static route again (idempotent)
|
|
|
|
ios_static_route:
|
|
|
|
prefix: 172.16.31.0
|
|
|
|
mask: 255.255.255.0
|
|
|
|
next_hop: 10.0.0.8
|
|
|
|
admin_distance: 2
|
|
|
|
state: absent
|
|
|
|
authorize: yes
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == false'
|
|
|
|
|
2017-07-26 14:09:17 +00:00
|
|
|
- name: Add static route aggregates
|
2017-06-29 10:05:20 +00:00
|
|
|
ios_static_route:
|
2017-07-26 14:09:17 +00:00
|
|
|
aggregate:
|
2017-06-29 10:05:20 +00:00
|
|
|
- { prefix: 172.16.32.0, mask: 255.255.255.0, next_hop: 10.0.0.8 }
|
|
|
|
- { prefix: 172.16.33.0, mask: 255.255.255.0, next_hop: 10.0.0.8 }
|
|
|
|
state: present
|
|
|
|
authorize: yes
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- 'result.commands == ["ip route 172.16.32.0 255.255.255.0 10.0.0.8 1", "ip route 172.16.33.0 255.255.255.0 10.0.0.8 1"]'
|
|
|
|
|
2017-07-26 14:09:17 +00:00
|
|
|
- name: Add and remove static route aggregates with overrides
|
2017-06-29 10:05:20 +00:00
|
|
|
ios_static_route:
|
2017-07-26 14:09:17 +00:00
|
|
|
aggregate:
|
2017-06-29 10:05:20 +00:00
|
|
|
- { prefix: 172.16.32.0, mask: 255.255.255.0, next_hop: 10.0.0.8 }
|
|
|
|
- { prefix: 172.16.33.0, mask: 255.255.255.0, next_hop: 10.0.0.8, state: absent }
|
|
|
|
- { prefix: 172.16.34.0, mask: 255.255.255.0, next_hop: 10.0.0.8 }
|
|
|
|
state: present
|
|
|
|
authorize: yes
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- 'result.commands == ["no ip route 172.16.33.0 255.255.255.0 10.0.0.8", "ip route 172.16.34.0 255.255.255.0 10.0.0.8 1"]'
|
|
|
|
|
2017-07-26 14:09:17 +00:00
|
|
|
- name: Remove static route aggregates
|
2017-06-29 10:05:20 +00:00
|
|
|
ios_static_route:
|
2017-07-26 14:09:17 +00:00
|
|
|
aggregate:
|
2017-06-29 10:05:20 +00:00
|
|
|
- { prefix: 172.16.32.0, mask: 255.255.255.0, next_hop: 10.0.0.8 }
|
|
|
|
- { prefix: 172.16.33.0, mask: 255.255.255.0, next_hop: 10.0.0.8 }
|
|
|
|
- { prefix: 172.16.34.0, mask: 255.255.255.0, next_hop: 10.0.0.8 }
|
|
|
|
state: absent
|
|
|
|
authorize: yes
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- 'result.commands == ["no ip route 172.16.32.0 255.255.255.0 10.0.0.8", "no ip route 172.16.34.0 255.255.255.0 10.0.0.8"]'
|