1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration/targets/nxos_config/tests/common/backup.yaml
Nathaniel Case 46263d77f1
Fixes for nxos_config integration tests (#34579)
* deletage_to: localhost -> connection: local

* Fix test setup
2018-01-08 10:56:47 -05:00

57 lines
1.3 KiB
YAML

---
- debug: msg="START connection={{ ansible_connection }}/backup.yaml"
- debug: msg="Using provider={{ connection.transport }}"
when: ansible_connection == "local"
# Select interface for test
- set_fact: intname="{{ nxos_int1 }}"
- name: setup
nxos_config:
commands:
- no description
- no shutdown
parents:
- "interface {{ intname }}"
match: none
provider: "{{ connection }}"
- name: collect any backup files
find: &backups
paths: "{{ role_path }}/backup"
pattern: "{{ inventory_hostname_short }}_config*"
connection: local
register: backup_files
- name: delete backup files
file:
path: "{{ item.path }}"
state: absent
with_items: "{{backup_files.files|default([])}}"
- name: configure device with config
nxos_config:
commands:
- description this is a test
- shutdown
parents:
- "interface {{ intname }}"
backup: yes
provider: "{{ connection }}"
register: result
- assert:
that:
- "result.changed == true"
- "result.updates is defined"
- name: collect any backup files
find: *backups
connection: local
register: backup_files
- assert:
that:
- "backup_files.files is defined"
- debug: msg="END connection={{ ansible_connection }}/backup.yaml"