2017-07-10 13:04:56 +02:00
|
|
|
---
|
2017-12-13 20:30:24 +01:00
|
|
|
- debug: msg="START cli/basic.yaml on connection={{ ansible_connection }}"
|
|
|
|
|
2017-07-10 13:04:56 +02:00
|
|
|
- name: create static route
|
|
|
|
vyos_static_route:
|
|
|
|
prefix: 172.24.0.0/24
|
|
|
|
next_hop: 192.168.42.64
|
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- '"set protocols static route 172.24.0.0/24 next-hop 192.168.42.64" in result.commands'
|
|
|
|
|
|
|
|
- name: create static route again (idempotent)
|
|
|
|
vyos_static_route:
|
|
|
|
prefix: 172.24.0.0
|
|
|
|
mask: 24
|
|
|
|
next_hop: 192.168.42.64
|
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == false'
|
|
|
|
|
|
|
|
- name: modify admin distance of static route
|
|
|
|
vyos_static_route:
|
|
|
|
prefix: 172.24.0.0/24
|
|
|
|
next_hop: 192.168.42.64
|
|
|
|
admin_distance: 1
|
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- '"set protocols static route 172.24.0.0/24 next-hop 192.168.42.64 distance 1" in result.commands'
|
|
|
|
|
|
|
|
- name: modify admin distance of static route again (idempotent)
|
|
|
|
vyos_static_route:
|
|
|
|
prefix: 172.24.0.0
|
|
|
|
mask: 24
|
|
|
|
next_hop: 192.168.42.64
|
|
|
|
admin_distance: 1
|
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == false'
|
|
|
|
|
|
|
|
- name: delete static route
|
|
|
|
vyos_static_route:
|
|
|
|
prefix: 172.24.0.0/24
|
|
|
|
next_hop: 192.168.42.64
|
|
|
|
admin_distance: 1
|
|
|
|
state: absent
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- '"delete protocols static route 172.24.0.0/24" in result.commands'
|
|
|
|
|
|
|
|
- name: delete static route again (idempotent)
|
|
|
|
vyos_static_route:
|
|
|
|
prefix: 172.24.0.0/24
|
|
|
|
next_hop: 192.168.42.64
|
|
|
|
admin_distance: 1
|
|
|
|
state: absent
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == false'
|
|
|
|
|
|
|
|
- name: Add static route collections
|
|
|
|
vyos_static_route:
|
2017-07-26 16:09:17 +02:00
|
|
|
aggregate:
|
2017-07-10 13:04:56 +02:00
|
|
|
- { prefix: 172.24.1.0/24, next_hop: 192.168.42.64 }
|
|
|
|
- { prefix: 172.24.2.0, mask: 24, next_hop: 192.168.42.64 }
|
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- '"set protocols static route 172.24.1.0/24 next-hop 192.168.42.64" in result.commands'
|
|
|
|
- '"set protocols static route 172.24.2.0/24 next-hop 192.168.42.64" in result.commands'
|
|
|
|
|
|
|
|
- name: Add and remove static route collections with overrides
|
|
|
|
vyos_static_route:
|
2017-07-26 16:09:17 +02:00
|
|
|
aggregate:
|
2017-07-10 13:04:56 +02:00
|
|
|
- { prefix: 172.24.1.0/24, next_hop: 192.168.42.64 }
|
|
|
|
- { prefix: 172.24.2.0/24, next_hop: 192.168.42.64, state: absent }
|
|
|
|
- { prefix: 172.24.3.0/24, next_hop: 192.168.42.64 }
|
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- '"delete protocols static route 172.24.2.0/24" in result.commands'
|
|
|
|
- '"set protocols static route 172.24.3.0/24 next-hop 192.168.42.64" in result.commands'
|
|
|
|
|
|
|
|
- name: Remove static route collections
|
|
|
|
vyos_static_route:
|
2017-07-26 16:09:17 +02:00
|
|
|
aggregate:
|
2017-07-10 13:04:56 +02:00
|
|
|
- { 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
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'result.changed == true'
|
|
|
|
- '"delete protocols static route 172.24.1.0/24" in result.commands'
|
|
|
|
- '"delete protocols static route 172.24.3.0/24" in result.commands'
|