2017-10-25 15:41:23 +00:00
|
|
|
---
|
|
|
|
- debug: msg="START TRANSPORT:NXAPI nxos_file_copy sanity test"
|
2018-01-05 17:39:04 +00:00
|
|
|
- debug: msg="Using provider={{ connection.transport }}"
|
|
|
|
when: ansible_connection == "local"
|
2017-10-25 15:41:23 +00:00
|
|
|
|
|
|
|
- name: "Setup - Remove existing file"
|
|
|
|
nxos_command: &remove_file
|
|
|
|
commands:
|
|
|
|
- command: terminal dont-ask
|
|
|
|
output: text
|
2018-02-02 12:54:53 +00:00
|
|
|
- command: delete network-integration.cfg
|
2017-10-25 15:41:23 +00:00
|
|
|
output: text
|
|
|
|
provider: "{{ nxapi }}"
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- name: "Setup - Turn on feature scp-server"
|
|
|
|
nxos_feature:
|
|
|
|
feature: scp-server
|
|
|
|
state: enabled
|
|
|
|
provider: "{{ nxapi }}"
|
|
|
|
|
|
|
|
- block:
|
2018-02-02 12:54:53 +00:00
|
|
|
- name: "Copy network-integration.cfg to bootflash"
|
2017-10-25 15:41:23 +00:00
|
|
|
nxos_file_copy: ©_file_same_name
|
2018-02-02 12:54:53 +00:00
|
|
|
local_file: "./network-integration.cfg"
|
2017-10-25 15:41:23 +00:00
|
|
|
file_system: "bootflash:"
|
|
|
|
provider: "{{ nxapi }}"
|
2017-11-14 15:23:11 +00:00
|
|
|
username: "{{ ansible_ssh_user }}"
|
|
|
|
password: "{{ ansible_ssh_pass }}"
|
2017-11-14 10:44:47 +00:00
|
|
|
host: "{{ ansible_host }}"
|
2017-11-28 05:24:23 +00:00
|
|
|
connect_ssh_port: "{{ ansible_ssh_port }}"
|
2017-10-25 15:41:23 +00:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: &true
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
|
2018-02-02 12:54:53 +00:00
|
|
|
- name: "Check Idempotence - Copy network-integration.cfg to bootflash"
|
2017-10-25 15:41:23 +00:00
|
|
|
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
|
|
|
|
ignore_errors: yes
|
|
|
|
|
2018-02-02 12:54:53 +00:00
|
|
|
- name: "Copy inventory.networking.template to bootflash as another name"
|
2017-10-25 15:41:23 +00:00
|
|
|
nxos_file_copy: ©_file_different_name
|
2018-02-02 12:54:53 +00:00
|
|
|
local_file: "./inventory.networking.template"
|
|
|
|
remote_file: "network-integration.cfg"
|
2017-10-25 15:41:23 +00:00
|
|
|
file_system: "bootflash:"
|
|
|
|
provider: "{{ nxapi }}"
|
2017-11-14 15:23:11 +00:00
|
|
|
username: "{{ ansible_ssh_user }}"
|
|
|
|
password: "{{ ansible_ssh_pass }}"
|
2017-11-14 10:44:47 +00:00
|
|
|
host: "{{ ansible_host }}"
|
2017-11-28 05:24:23 +00:00
|
|
|
connect_ssh_port: "{{ ansible_ssh_port }}"
|
2017-10-25 15:41:23 +00:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
2018-02-02 12:54:53 +00:00
|
|
|
- name: "Check Idempotence - Copy inventory.networking.template to bootflash as another name"
|
2017-10-25 15:41:23 +00:00
|
|
|
nxos_file_copy: *copy_file_different_name
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
|
|
|
- name: "Setup - Remove existing file"
|
|
|
|
nxos_command: *remove_file
|
|
|
|
register: result
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
rescue:
|
|
|
|
|
|
|
|
- debug: msg="TRANSPORT:NXAPI 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: "{{ nxapi }}"
|
|
|
|
|
|
|
|
- debug: msg="END TRANSPORT:NXAPI nxos_file_copy sanity test"
|