2016-10-28 20:50:29 +02:00
|
|
|
---
|
2017-08-21 17:15:25 +02:00
|
|
|
- debug: msg="START {{ connection.transport }}/backup.yaml"
|
2016-10-28 20:50:29 +02:00
|
|
|
|
2017-09-01 11:44:24 +02:00
|
|
|
# Select interface for test
|
|
|
|
- set_fact: intname="{{ nxos_int1 }}"
|
|
|
|
|
2016-10-28 20:50:29 +02:00
|
|
|
- name: setup
|
|
|
|
nxos_config:
|
|
|
|
commands:
|
|
|
|
- no description
|
|
|
|
- no shutdown
|
|
|
|
parents:
|
2017-09-01 11:44:24 +02:00
|
|
|
- "interface {{ intname }}"
|
2016-10-28 20:50:29 +02:00
|
|
|
match: none
|
2017-08-21 17:15:25 +02:00
|
|
|
provider: "{{ connection }}"
|
2016-10-28 20:50:29 +02:00
|
|
|
|
|
|
|
- name: collect any backup files
|
|
|
|
find:
|
|
|
|
paths: "{{ role_path }}/backup"
|
2017-01-09 18:21:04 +01:00
|
|
|
pattern: "{{ inventory_hostname_short }}_config*"
|
2016-10-28 20:50:29 +02:00
|
|
|
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
|
|
|
|
nxos_config:
|
2017-09-01 11:44:24 +02:00
|
|
|
commands:
|
|
|
|
- description this is a test
|
|
|
|
- shutdown
|
|
|
|
parents:
|
|
|
|
- "interface {{ intname }}"
|
2016-10-28 20:50:29 +02:00
|
|
|
backup: yes
|
2017-08-21 17:15:25 +02:00
|
|
|
provider: "{{ connection }}"
|
2016-10-28 20:50:29 +02:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2017-02-25 22:36:00 +01:00
|
|
|
- "result.updates is defined"
|
2016-10-28 20:50:29 +02:00
|
|
|
|
|
|
|
- name: collect any backup files
|
|
|
|
find:
|
|
|
|
paths: "{{ role_path }}/backup"
|
2017-01-09 18:21:04 +01:00
|
|
|
pattern: "{{ inventory_hostname_short }}_config*"
|
2016-10-28 20:50:29 +02:00
|
|
|
register: backup_files
|
|
|
|
delegate_to: localhost
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "backup_files.files is defined"
|
|
|
|
|
2017-08-21 17:15:25 +02:00
|
|
|
- debug: msg="END {{ connection.transport }}/backup.yaml"
|