Files
toallab-automation/roles/ansible-network.cisco_ios/includes/checkpoint/restore.yaml
Patrick Toal 6e2205a046 Adding Netbox
2019-05-06 00:34:45 -04:00

33 lines
1.0 KiB
YAML

---
- name: validate ios_checkpoint_filename is defined
fail:
msg: "missing required var: ios_checkpoint_filename"
when: ios_checkpoint_filename is undefined
- name: get current files on disk
cli:
command: dir
register: ios_dir_listing
- name: verify checkpoint file exists
fail:
msg: "missing checkpoint file {{ ios_checkpoing_filename }}"
when: ios_checkpoint_filename not in ios_dir_listing.stdout
- name: checkpoint configuration restore pre hook
include_tasks: "{{ ios_checkpoint_restore_pre_hook }}"
when: ios_checkpoint_restore_pre_hook is defined
- name: restore checkpoint configuration
cli:
command: "config replace flash:/{{ ios_checkpoint_filename }} force"
register: ios_rollback_results
- name: checkpoint configuration restore post hook
include_tasks: "{{ ios_checkpoint_restore_post_hook }}"
when: ios_checkpoint_restore_post_hook is defined
- name: remove checkpoint file from remote device
cli:
command: "delete /force flash:/{{ ios_checkpoint_filename }}"