summaryrefslogtreecommitdiff
path: root/test/integration/targets/ios_template/tests/cli/backup.yaml
blob: 87c37c9d001fd730aca7ee9df1a9877b54471499 (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
51
52
53
54
55
---
- debug: msg="START cli/backup.yaml"

- name: setup
  ios_config:
    commands:
      - no interface Loopback999
    match: none
    provider: "{{ cli }}"
  ignore_errors: yes

- 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
  ios_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"

- name: teardown
  ios_config:
    commands:
      - no interface Loopback999
    match: none
    provider: "{{ cli }}"

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