2018-08-06 16:41:57 +02:00
|
|
|
---
|
|
|
|
- debug:
|
|
|
|
msg: "START cli/cli_command.yaml on connection={{ ansible_connection }}"
|
|
|
|
|
2019-05-27 06:34:03 +02:00
|
|
|
- block:
|
|
|
|
- name: get output for single command
|
|
|
|
cli_command:
|
|
|
|
command: show version
|
|
|
|
register: result
|
2018-08-06 16:41:57 +02:00
|
|
|
|
2019-05-27 06:34:03 +02:00
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
- "result.stdout is defined"
|
2018-08-06 16:41:57 +02:00
|
|
|
|
2019-05-27 06:34:03 +02:00
|
|
|
- name: send invalid command
|
|
|
|
cli_command:
|
|
|
|
command: 'show foo'
|
|
|
|
register: result
|
|
|
|
ignore_errors: yes
|
2018-08-06 16:41:57 +02:00
|
|
|
|
2019-05-27 06:34:03 +02:00
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.failed == true"
|
|
|
|
- "result.msg is defined"
|
|
|
|
when: "ansible_connection == 'network_cli'"
|
2018-08-06 16:41:57 +02:00
|
|
|
|
|
|
|
- debug: msg="END cli/cli_command.yaml on connection={{ ansible_connection }}"
|