30688fecf3
* Idempotency for net_get and net_put modules * pep8 warnings fix * remove import q
77 lines
1.7 KiB
YAML
77 lines
1.7 KiB
YAML
---
|
|
- debug: msg="START ios cli/net_put.yaml on connection={{ ansible_connection }}"
|
|
|
|
# Add minimal testcase to check args are passed correctly to
|
|
# implementation module and module run is successful.
|
|
|
|
- name: setup
|
|
ios_config:
|
|
lines:
|
|
- ip ssh version 2
|
|
- ip scp server enable
|
|
- username {{ ansible_ssh_user }} privilege 15
|
|
match: none
|
|
|
|
- name: Delete existing file ios1.cfg if presen on remote host
|
|
ios_command:
|
|
commands:
|
|
- command: 'delete /force ios1.cfg'
|
|
ignore_errors: true
|
|
|
|
- name: Delete existing file ios.cfg if presen on remote host
|
|
ios_command:
|
|
commands:
|
|
- command: 'delete /force ios.cfg'
|
|
ignore_errors: true
|
|
|
|
- name: Delete existing file nonascii.bin if presen on remote host
|
|
ios_command:
|
|
commands:
|
|
- command: 'delete /force nonascii.bin'
|
|
ignore_errors: true
|
|
|
|
- name: copy file from controller to ios + scp (Default)
|
|
net_put:
|
|
src: ios1.cfg
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- result.changed == true
|
|
|
|
- name: Idempotency Check
|
|
net_put:
|
|
src: ios1.cfg
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- result.changed == false
|
|
|
|
- name: copy file from controller to ios + dest specified
|
|
net_put:
|
|
src: ios1.cfg
|
|
dest: ios.cfg
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- result.changed == true
|
|
|
|
- name: copy file with non-ascii characters to ios in template mode(Fail case)
|
|
net_put:
|
|
src: nonascii.bin
|
|
mode: 'text'
|
|
register: result
|
|
ignore_errors: true
|
|
|
|
- name: copy file with non-ascii characters to ios in default mode(binary)
|
|
net_put:
|
|
src: nonascii.bin
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- result.changed == true
|
|
|
|
- debug: msg="END ios cli/net_put.yaml on connection={{ ansible_connection }}"
|