|
|
@ -23,31 +23,23 @@
|
|
|
|
- "result.failed == true"
|
|
|
|
- "result.failed == true"
|
|
|
|
- "result.msg is defined"
|
|
|
|
- "result.msg is defined"
|
|
|
|
|
|
|
|
|
|
|
|
- name: Remove existing file if any
|
|
|
|
- name: delete config file on disk to prevent failure of copy task for duplicate
|
|
|
|
cli_command:
|
|
|
|
cli_command:
|
|
|
|
command: 'delete harddisk:ansible_tmp.txt'
|
|
|
|
command: 'delete harddisk:ansible_tmp.txt'
|
|
|
|
prompt: 'Delete harddisk\:ansible_tmp\.txt\[confirm\]'
|
|
|
|
prompt: 'Delete harddisk\:/?ansible_tmp\.txt\[confirm\]'
|
|
|
|
answer: "\r\n"
|
|
|
|
answer: ""
|
|
|
|
ignore_errors: yes
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: Run command with prompt
|
|
|
|
- name: Run command with prompt
|
|
|
|
cli_command:
|
|
|
|
cli_command:
|
|
|
|
command: 'copy running-config harddisk:ansible_tmp.txt'
|
|
|
|
command: 'copy running-config harddisk:ansible_tmp.txt'
|
|
|
|
prompt: 'Destination file name \(control-c to abort\)\: \[\/ansible_tmp.txt\]\?'
|
|
|
|
prompt: 'Destination file name \(control-c to abort\)\: \[\/ansible_tmp.txt\]\?'
|
|
|
|
answer: 'ansible_tmp.txt'
|
|
|
|
answer: 'ansible_tmp.txt'
|
|
|
|
register: result
|
|
|
|
register: result
|
|
|
|
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
that:
|
|
|
|
- "result.stdout is defined"
|
|
|
|
- "result.stdout is defined"
|
|
|
|
- "'ansible_tmp' in result.stdout"
|
|
|
|
- "'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 }}"
|
|
|
|
- debug: msg="END cli/cli_command.yaml on connection={{ ansible_connection }}"
|
|
|
|