ansible/test/integration/targets/ios_file/tests/cli/net_get.yaml
Nathaniel Case 6b162142a7 ios_file: Don't leave leftover files behind (#42622)
* Don't leave leftover files behind

* Fix writing files in python3

* Replace nonascii.bin with one that will not pass for unicode
2018-07-12 12:26:14 +05:30

52 lines
1.2 KiB
YAML

---
- 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
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)
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
net_get:
src: ios1.cfg
dest: 'ios_{{ inventory_hostname }}.cfg'
register: result
- assert:
that:
- result.changed == true
- name: Idempotency check
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 }}"