2017-08-29 15:21:49 +00:00
|
|
|
---
|
|
|
|
- debug: msg="START cli/ping.yaml"
|
|
|
|
|
2017-10-11 10:10:11 +00:00
|
|
|
- name: Get show ip interface GigabitEthernet0/0 output
|
|
|
|
ios_command:
|
|
|
|
commands:
|
|
|
|
- show ip interface GigabitEthernet0/0 | include Internet address
|
|
|
|
authorize: yes
|
|
|
|
register: show_ip_interface_result
|
|
|
|
|
|
|
|
- name: Extract the IP address from registered output
|
|
|
|
set_fact: management_ip="{{ show_ip_interface_result.stdout[0].split()[-1].split('/')[0] }}"
|
|
|
|
|
2017-08-29 15:21:49 +00:00
|
|
|
- name: expected successful ping
|
|
|
|
ios_ping: &valid_ip
|
2017-10-11 10:10:11 +00:00
|
|
|
dest: '{{ management_ip }}'
|
2017-09-28 09:53:52 +00:00
|
|
|
authorize: yes
|
2017-08-29 15:21:49 +00:00
|
|
|
register: esp
|
2017-10-11 10:28:10 +00:00
|
|
|
|
2017-08-29 15:21:49 +00:00
|
|
|
- name: unexpected unsuccessful ping
|
|
|
|
ios_ping: &invalid_ip
|
|
|
|
dest: '10.255.255.250'
|
|
|
|
timeout: 45
|
2017-09-28 09:53:52 +00:00
|
|
|
authorize: yes
|
2017-08-29 15:21:49 +00:00
|
|
|
register: uup
|
2017-10-11 10:10:11 +00:00
|
|
|
ignore_errors: yes
|
2017-08-29 15:21:49 +00:00
|
|
|
|
|
|
|
- name: unexpected successful ping
|
|
|
|
ios_ping:
|
|
|
|
<<: *valid_ip
|
|
|
|
state: 'absent'
|
|
|
|
register: usp
|
2017-10-11 10:10:11 +00:00
|
|
|
ignore_errors: yes
|
2017-08-29 15:21:49 +00:00
|
|
|
|
|
|
|
- name: expected unsuccessful ping
|
|
|
|
ios_ping:
|
|
|
|
<<: *invalid_ip
|
|
|
|
state: 'absent'
|
|
|
|
register: eup
|
|
|
|
|
|
|
|
- name: assert
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- esp.failed == eup.failed == false
|
|
|
|
- usp.failed == uup.failed == true
|