2016-10-28 18:50:29 +00:00
|
|
|
---
|
2018-01-08 12:28:47 +00:00
|
|
|
- debug: msg="START netconf/backup.yaml on connection={{ ansible_connection }}"
|
2016-10-28 18:50:29 +00:00
|
|
|
|
|
|
|
- name: setup
|
|
|
|
junos_config:
|
|
|
|
lines:
|
2017-01-09 17:21:04 +00:00
|
|
|
- set system host-name {{ inventory_hostname_short }}
|
2016-10-28 18:50:29 +00:00
|
|
|
- delete interfaces lo0
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
|
|
|
|
- name: collect any backup files
|
|
|
|
find:
|
|
|
|
paths: "{{ role_path }}/backup"
|
2017-01-09 17:21:04 +00:00
|
|
|
pattern: "{{ inventory_hostname_short }}_config*"
|
2016-10-28 18:50:29 +00:00
|
|
|
register: backup_files
|
2018-01-08 17:52:53 +00:00
|
|
|
connection: local
|
2016-10-28 18:50:29 +00:00
|
|
|
|
|
|
|
- name: delete backup files
|
|
|
|
file:
|
|
|
|
path: "{{ item.path }}"
|
|
|
|
state: absent
|
2018-01-08 17:52:53 +00:00
|
|
|
connection: local
|
2016-10-28 18:50:29 +00:00
|
|
|
with_items: "{{backup_files.files|default([])}}"
|
|
|
|
|
|
|
|
- name: configure device with config
|
|
|
|
junos_config:
|
|
|
|
src: basic/config.j2
|
|
|
|
backup: yes
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
- "result.updates is not defined"
|
|
|
|
|
|
|
|
- name: collect any backup files
|
|
|
|
find:
|
|
|
|
paths: "{{ role_path }}/backup"
|
2017-01-09 17:21:04 +00:00
|
|
|
pattern: "{{ inventory_hostname_short }}_config*"
|
2016-10-28 18:50:29 +00:00
|
|
|
register: backup_files
|
2018-01-08 17:52:53 +00:00
|
|
|
connection: local
|
2016-10-28 18:50:29 +00:00
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "backup_files.files is defined"
|
|
|
|
|
2018-01-08 12:28:47 +00:00
|
|
|
- debug: msg="END netconf/backup.yaml on connection={{ ansible_connection }}"
|