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

27 lines
914 B
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: remove old checkpoint file (if necessary)
cli:
command: "delete /force flash:/{{ ios_checkpoint_filename }}"
when: ios_checkpoint_filename in ios_dir_listing.stdout
# copy the current running-config to the local flash disk on the target device.
# This will be used both for restoring the current config if a failure happens
# as well as performing a configuration diff once the new config has been
# loaded.
- name: create a checkpoint of the current running-config
ios_command:
commands:
- command: "copy running-config flash:{{ ios_checkpoint_filename }}"
prompt: ["\\? "]
answer: "{{ ios_checkpoint_filename }}"