1---
2- debug:
3    msg: "START ios cli/net_put.yaml on connection={{ ansible_connection }}"
4
5# Add minimal testcase to check args are passed correctly to
6# implementation module and module run is successful.
7
8- name: setup
9  cisco.ios.ios_config:
10    lines:
11      - ip ssh version 2
12      - ip scp server enable
13      - username {{ ansible_ssh_user }} privilege 15
14    match: none
15
16- name: Delete existing files if present on remote host
17  cisco.ios.ios_command:
18     commands: "{{ item }}"
19  loop:
20     - delete /force ios1.cfg
21     - delete /force ios.cfg
22     - delete /force nonascii.bin
23  ignore_errors: true
24
25- name: copy file from controller to ios + scp (Default)
26  ansible.netcommon.net_put:
27    src: ios1.cfg
28  register: result
29
30- assert:
31    that:
32      - result.changed == true
33
34- name: Idempotency Check
35  ansible.netcommon.net_put:
36    src: ios1.cfg
37  register: result
38
39- assert:
40    that:
41      - result.changed == false
42
43- name: copy file from controller to ios + dest specified
44  ansible.netcommon.net_put:
45    src: ios1.cfg
46    dest: ios.cfg
47  register: result
48
49- assert:
50    that:
51      - result.changed == true
52
53- name: copy file with non-ascii characters to ios in template mode(Fail case)
54  ansible.netcommon.net_put:
55    src: nonascii.bin
56    mode: 'text'
57  register: result
58  ignore_errors: true
59
60- assert:
61    that:
62      - result.failed == true
63
64- name: copy file with non-ascii characters to ios in default mode(binary)
65  ansible.netcommon.net_put:
66    src: nonascii.bin
67  register: result
68
69- assert:
70    that:
71      - result.changed == true
72
73- debug: msg="END ios cli/net_put.yaml on connection={{ ansible_connection }}"
74