blob: 5a7ebf077e2938b30c453df9e5ac58a75a02a33b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
---
- debug: msg="START ios cli/net_get.yaml on connection={{ ansible_connection }}"
# Add minimal testcase to check args are passed correctly to
# implementation module and module run is successful.
- name: setup
cisco.ios.ios_config:
lines:
- ip ssh version 2
- ip scp server enable
- username {{ ansible_ssh_user }} privilege 15
match: none
- name: setup (copy file to be fetched from device)
ansible.netcommon.net_put:
src: ios1.cfg
register: result
- name: setup (remove file from localhost if present)
file:
path: ios_{{ inventory_hostname }}.cfg
state: absent
delegate_to: localhost
- name: get the file from device with relative destination
ansible.netcommon.net_get:
src: ios1.cfg
dest: 'ios_{{ inventory_hostname }}.cfg'
register: result
- assert:
that:
- result.changed == true
- name: Idempotency check
ansible.netcommon.net_get:
src: ios1.cfg
dest: 'ios_{{ inventory_hostname }}.cfg'
register: result
- assert:
that:
- result.changed == false
- name: setup (remove file from localhost if present)
file:
path: ios_{{ inventory_hostname }}.cfg
state: absent
delegate_to: localhost
- debug: msg="END ios cli/net_get.yaml on connection={{ ansible_connection }}"
|