2018-05-16 11:08:43 +02:00
|
|
|
---
|
2018-07-12 08:56:14 +02:00
|
|
|
- debug:
|
|
|
|
msg: "START ios cli/net_put.yaml on connection={{ ansible_connection }}"
|
2018-05-16 11:08:43 +02:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2018-07-12 08:56:14 +02:00
|
|
|
- name: Delete existing files if present on remote host
|
2018-07-05 16:45:25 +02:00
|
|
|
ios_command:
|
2018-07-12 08:56:14 +02:00
|
|
|
commands: "{{ item }}"
|
|
|
|
loop:
|
|
|
|
- delete /force ios1.cfg
|
|
|
|
- delete /force ios.cfg
|
|
|
|
- delete /force nonascii.bin
|
2018-07-05 16:45:25 +02:00
|
|
|
ignore_errors: true
|
|
|
|
|
2018-05-16 11:08:43 +02:00
|
|
|
- name: copy file from controller to ios + scp (Default)
|
2018-05-18 11:11:47 +02:00
|
|
|
net_put:
|
2018-05-16 11:08:43 +02:00
|
|
|
src: ios1.cfg
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- result.changed == true
|
|
|
|
|
2018-07-05 16:45:25 +02:00
|
|
|
- name: Idempotency Check
|
|
|
|
net_put:
|
|
|
|
src: ios1.cfg
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- result.changed == false
|
|
|
|
|
2018-05-16 11:08:43 +02:00
|
|
|
- name: copy file from controller to ios + dest specified
|
2018-05-18 11:11:47 +02:00
|
|
|
net_put:
|
2018-05-16 11:08:43 +02:00
|
|
|
src: ios1.cfg
|
|
|
|
dest: ios.cfg
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- result.changed == true
|
|
|
|
|
2018-06-20 12:32:49 +02:00
|
|
|
- name: copy file with non-ascii characters to ios in template mode(Fail case)
|
|
|
|
net_put:
|
|
|
|
src: nonascii.bin
|
2018-07-05 16:45:25 +02:00
|
|
|
mode: 'text'
|
2018-06-20 12:32:49 +02:00
|
|
|
register: result
|
|
|
|
ignore_errors: true
|
|
|
|
|
2018-07-12 08:56:14 +02:00
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- result.failed == true
|
|
|
|
|
2018-06-20 12:32:49 +02:00
|
|
|
- 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
|
|
|
|
|
2018-05-18 11:11:47 +02:00
|
|
|
- debug: msg="END ios cli/net_put.yaml on connection={{ ansible_connection }}"
|