1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration/targets/iosxr_command/tests/cli/cli_command.yaml
2018-08-13 19:49:56 +05:30

53 lines
1.3 KiB
YAML

---
- debug:
msg: "START cli/cli_command.yaml on connection={{ ansible_connection }}"
- name: get output for single command
cli_command:
command: show version
register: result
- assert:
that:
- "result.changed == false"
- "result.stdout is defined"
- name: send invalid command
cli_command:
command: 'show foo'
register: result
ignore_errors: yes
- assert:
that:
- "result.failed == true"
- "result.msg is defined"
- name: Remove existing file if any
cli_command:
command: 'delete harddisk:ansible_tmp.txt'
prompt: 'Delete harddisk\:ansible_tmp\.txt\[confirm\]'
answer: "\r\n"
ignore_errors: yes
- block:
- name: Run command with prompt
cli_command:
command: 'copy running-config harddisk:ansible_tmp.txt'
prompt: 'Destination file name \(control-c to abort\)\: \[\/ansible_tmp.txt\]\?'
answer: 'ansible_tmp.txt'
register: result
- assert:
that:
- "result.stdout is defined"
- "'ansible_tmp' in result.stdout"
always:
- name: Remove copied file
cli_command:
command: 'delete harddisk:ansible_tmp.txt'
prompt: 'Delete harddisk\:ansible_tmp\.txt\[confirm\]'
answer: "\r\n"
ignore_errors: yes
- debug: msg="END cli/cli_command.yaml on connection={{ ansible_connection }}"