Adding Netbox

This commit is contained in:
Patrick Toal
2019-05-06 00:34:45 -04:00
parent 832502de34
commit 6e2205a046
278 changed files with 12767 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
---
- 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 }}"

View File

@@ -0,0 +1,15 @@
---
- 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 checkpoint file from remote device
cli:
command: "delete /force flash:/{{ ios_checkpoint_filename }}"
when: ios_checkpoint_filename in ios_dir_listing.stdout

View File

@@ -0,0 +1,32 @@
---
- 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 }}"