summaryrefslogtreecommitdiff
path: root/test/integration/targets/nxos_template/tests/cli/backup.yaml
blob: 3760dabe536b2708ddcbe5eb015abb9095b5e5de (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
---
- debug: msg="START cli/backup.yaml"

- name: setup
  nxos_config:
    commands:
      - no description
      - no shutdown
    parents:
      - interface Ethernet2/5
    match: none
    provider: "{{ cli }}"

- name: collect any backup files
  find:
    paths: "{{ role_path }}/backup"
    pattern: "{{ inventory_hostname }}_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
  nxos_template:
    src: basic/config.j2
    backup: yes
    provider: "{{ cli }}"
  register: result

- assert:
    that:
      - "result.changed == true"
      - "result.updates is defined"

- name: collect any backup files
  find:
    paths: "{{ role_path }}/backup"
    pattern: "{{ inventory_hostname }}_config*"
  register: backup_files
  delegate_to: localhost

- assert:
    that:
      - "backup_files.files is defined"

- debug: msg="END cli/backup.yaml"