2017-10-25 17:41:23 +02:00
|
|
|
---
|
|
|
|
- debug: msg="START TRANSPORT:CLI nxos_file_copy sanity test"
|
|
|
|
|
|
|
|
- name: "Setup - Remove existing file"
|
|
|
|
nxos_command: &remove_file
|
|
|
|
commands:
|
|
|
|
- terminal dont-ask
|
|
|
|
- delete nxos.yaml
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- name: "Setup - Turn on feature scp-server"
|
|
|
|
nxos_feature:
|
|
|
|
feature: scp-server
|
|
|
|
state: enabled
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: "Copy nxos.yaml to bootflash"
|
|
|
|
nxos_file_copy: ©_file_same_name
|
|
|
|
local_file: "./nxos.yaml"
|
|
|
|
file_system: "bootflash:"
|
|
|
|
provider: "{{ cli }}"
|
2017-11-14 16:23:11 +01:00
|
|
|
username: "{{ ansible_ssh_user }}"
|
|
|
|
password: "{{ ansible_ssh_pass }}"
|
2017-11-14 11:44:47 +01:00
|
|
|
host: "{{ ansible_host }}"
|
2017-11-28 06:24:23 +01:00
|
|
|
connect_ssh_port: "{{ ansible_ssh_port }}"
|
2017-10-25 17:41:23 +02:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: &true
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
|
|
|
|
- name: "Check Idempotence - Copy nxos.yaml to bootflash"
|
|
|
|
nxos_file_copy: *copy_file_same_name
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: &false
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
|
|
|
- name: "Setup - Remove existing file"
|
|
|
|
nxos_command: *remove_file
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- name: "Copy ios.yaml to bootflash as another name"
|
|
|
|
nxos_file_copy: ©_file_different_name
|
|
|
|
local_file: "./ios.yaml"
|
|
|
|
remote_file: "nxos.yaml"
|
|
|
|
file_system: "bootflash:"
|
|
|
|
provider: "{{ cli }}"
|
2017-11-14 16:23:11 +01:00
|
|
|
username: "{{ ansible_ssh_user }}"
|
|
|
|
password: "{{ ansible_ssh_pass }}"
|
2017-11-14 11:44:47 +01:00
|
|
|
host: "{{ ansible_host }}"
|
2017-11-28 06:24:23 +01:00
|
|
|
connect_ssh_port: "{{ ansible_ssh_port }}"
|
2017-10-25 17:41:23 +02:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: "Check Idempotence - Copy ios.yaml to bootflash as another name"
|
|
|
|
nxos_file_copy: *copy_file_different_name
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
- name: "Setup - Remove existing file"
|
|
|
|
nxos_command: *remove_file
|
|
|
|
register: result
|
|
|
|
|
|
|
|
rescue:
|
|
|
|
|
|
|
|
- debug: msg="TRANSPORT:CLI nxos_file_copy failure detected"
|
|
|
|
|
|
|
|
always:
|
|
|
|
|
|
|
|
- name: "Remove file"
|
|
|
|
nxos_command: *remove_file
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- name: "Turn off feature scp-server"
|
|
|
|
nxos_feature:
|
|
|
|
feature: scp-server
|
|
|
|
state: disabled
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
|
|
|
|
- debug: msg="END TRANSPORT:CLI nxos_file_copy sanity test"
|