ansible/test/integration/targets/cnos_config/tests/cli/backup.yaml
2019-04-05 21:50:29 -04:00

49 lines
982 B
YAML

---
- debug: msg="START cli/backup.yaml"
- name: setup
cnos_config:
commands:
- no vlan 13
ignore_errors: yes
- name: collect any backup files
find:
paths: "{{ role_path }}/backup"
pattern: "{{ inventory_hostname_short }}_config*"
register: backup_files
delegate_to: localhost
- name: delete backup files
file:
path: "{{ item.path }}"
state: absent
with_items: "{{backup_files.files|default([])}}"
- name: configure device with config
cnos_config:
src: roles/cnos_config/templates/basic/config.j2
backup: yes
register: result
- assert:
that:
- "result.changed == true"
- name: collect any backup files
find:
paths: "{{ role_path }}/backup"
pattern: "{{ inventory_hostname_short }}_config*"
register: backup_files
delegate_to: localhost
- assert:
that:
- "backup_files.files is defined"
- name: teardown
cnos_config:
commands:
- no vlan 13
- debug: msg="END cli/backup.yaml"