mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
89 lines
2.2 KiB
YAML
89 lines
2.2 KiB
YAML
|
---
|
||
|
- debug: msg="START TRANSPORT:NXAPI nxos_file_copy sanity test"
|
||
|
|
||
|
- name: "Setup - Remove existing file"
|
||
|
nxos_command: &remove_file
|
||
|
commands:
|
||
|
- command: terminal dont-ask
|
||
|
output: text
|
||
|
- command: delete nxos.yaml
|
||
|
output: text
|
||
|
provider: "{{ nxapi }}"
|
||
|
ignore_errors: yes
|
||
|
|
||
|
- name: "Setup - Turn on feature scp-server"
|
||
|
nxos_feature:
|
||
|
feature: scp-server
|
||
|
state: enabled
|
||
|
provider: "{{ nxapi }}"
|
||
|
|
||
|
- block:
|
||
|
- name: "Copy nxos.yaml to bootflash"
|
||
|
nxos_file_copy: ©_file_same_name
|
||
|
local_file: "./nxos.yaml"
|
||
|
file_system: "bootflash:"
|
||
|
provider: "{{ nxapi }}"
|
||
|
username: "{{ nxos_nxapi_user | default('admin') }}"
|
||
|
password: "{{ nxos_nxapi_pass | default('admin') }}"
|
||
|
host: "{{ inventory_hostname }}"
|
||
|
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
|
||
|
ignore_errors: yes
|
||
|
|
||
|
- 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: "{{ nxapi }}"
|
||
|
username: "{{ nxos_nxapi_user | default('admin') }}"
|
||
|
password: "{{ nxos_nxapi_pass | default('admin') }}"
|
||
|
host: "{{ inventory_hostname }}"
|
||
|
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
|
||
|
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"
|