@ -1,9 +1,23 @@
---
---
- debug : msg="START ios_interface cli/intent.yaml"
- debug : msg="START ios_interface cli/intent.yaml"
- name : Run show version
ios_command:
commands : show version
register : show_version_result
- name : Set test interface to GigabitEthernet0/2 if we are on Cisco IOS
set_fact : test_interface=GigabitEthernet0/2
when : "'Cisco IOS' in show_version_result.stdout[0]"
- name : Set test interface to GigabitEthernet2 if we are on Cisco IOS-XE
set_fact : test_interface=GigabitEthernet2
when : "'Cisco IOS-XE' in show_version_result.stdout[0]"
- name : Check intent arguments
- name : Check intent arguments
ios_interface:
ios_interface:
name : GigabitEthernet0/2
name : "{{ test_interface }}"
state : up
state : up
tx_rate : ge(0)
tx_rate : ge(0)
rx_rate : le(0)
rx_rate : le(0)
@ -16,7 +30,7 @@
- name : Check intent arguments (failed condition)
- name : Check intent arguments (failed condition)
ios_interface:
ios_interface:
name : GigabitEthernet0/2
name : "{{ test_interface }}"
state : down
state : down
tx_rate : gt(0)
tx_rate : gt(0)
rx_rate : lt(0)
rx_rate : lt(0)
@ -33,7 +47,7 @@
- name : Config + intent
- name : Config + intent
ios_interface:
ios_interface:
name : GigabitEthernet0/2
name : "{{ test_interface }}"
enabled : False
enabled : False
state : down
state : down
authorize : yes
authorize : yes
@ -45,7 +59,7 @@
- name : Config + intent (fail)
- name : Config + intent (fail)
ios_interface:
ios_interface:
name : GigabitEthernet0/2
name : "{{ test_interface }}"
enabled : False
enabled : False
authorize : yes
authorize : yes
state : up
state : up
@ -98,7 +112,7 @@
- name : Aggregate config + intent (pass)
- name : Aggregate config + intent (pass)
ios_interface:
ios_interface:
aggregate:
aggregate:
- name : GigabitEthernet0/2
- name : "{{ test_interface }}"
enabled : True
enabled : True
state : up
state : up
authorize : yes
authorize : yes