@ -2,28 +2,32 @@
- debug:
- debug:
msg : "START cli/cli_command.yaml on connection={{ ansible_connection }}"
msg : "START cli/cli_command.yaml on connection={{ ansible_connection }}"
- name : get output for single command
- block:
cli_command:
- name : get output for single command
c ommands :
c li_c ommand:
- show version
command : show version
register : result
register : result
- assert:
- assert:
that:
that:
- "result.changed == false"
- "result.changed == false"
- "result.stdout is defined"
- "result.stdout is defined"
- name : get output for multiple commands
- name : test with prompt and answer
cli_command:
cli_command:
commands:
command : "{{ item }}"
- show version
prompt:
- show interfaces
- "Exit with uncommitted changes"
register : result
answer : yes
loop:
- configure
- set system syslog file test any any
- exit
register : result
- assert:
- assert:
that:
that:
- "result.changed == false"
- "result.changed == false"
- "result.stdout is defined"
when : ansible_connection == 'network_cli'
- "result.stdout | length == 2"
- debug : msg="END cli/cli_command.yaml on connection={{ ansible_connection }}"
- debug : msg="END cli/cli_command.yaml on connection={{ ansible_connection }}"