-
Notifications
You must be signed in to change notification settings - Fork 16
Add rescue function support #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: devel
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,89 @@ | ||||||
# Save and Load rescue configuration into device | ||||||
|
||||||
The `config_manager/rescue` function provides a means to save a know good running configuration | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
as a rescue configuration and rollback the current device configuration to rescue configuration | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
when required. | ||||||
|
||||||
The `rescue` function provides some configurable options when rescuing the | ||||||
configuration on the remote device. See the `How to use this function` | ||||||
section for different example of how to rescue configuration on network devices. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
## How to use this function | ||||||
|
||||||
The examples below demonstrate how to use this function in a playbook. | ||||||
|
||||||
## How to save a rescue configuration checkpoint | ||||||
|
||||||
Below is an example of how to call the `config_manager/rescue` function to mark the | ||||||
current running configuration as rescue config. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
``` | ||||||
- hosts: network | ||||||
|
||||||
roles: | ||||||
- name: ansible-network.config_manager | ||||||
function: rescue | ||||||
config_manager_set_rescue: True | ||||||
``` | ||||||
|
||||||
### How to load the rescue configuration | ||||||
|
||||||
The `config_manager/rescue` function also provides support to rollback the current running | ||||||
configuration to a rescue configuration when required | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
In order to load the resuce configuration, the function as before but adds the | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
value `config_manager_load_rescue_config: yes` to the playbook to indicate that the configuration should | ||||||
be rollbacked to te the resuce configuration. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
Note: Take caution when doing rescue configuration load that you do not | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
inadvertently replace your access to the device. | ||||||
|
||||||
``` | ||||||
- hosts: network | ||||||
|
||||||
roles: | ||||||
- name: ansible-network.config_manager | ||||||
function: rescue | ||||||
config_manager_load_rescue_config: True | ||||||
``` | ||||||
|
||||||
## How to delete a rescue configuration checkpoint | ||||||
|
||||||
Below is an example of how to call the `config_manager/rescue` function to delete the | ||||||
previously set rescue configuration. | ||||||
|
||||||
``` | ||||||
- hosts: network | ||||||
|
||||||
roles: | ||||||
- name: ansible-network.config_manager | ||||||
function: rescue | ||||||
config_manager_delete_rescue: True | ||||||
``` | ||||||
|
||||||
## Arguments | ||||||
|
||||||
### config_manager_set_rescue | ||||||
|
||||||
This setting indicates whether or not the to set the current running | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
configuration as the rescue configuration. | ||||||
|
||||||
The default value is `False` | ||||||
|
||||||
### config_manager_load_rescue_config | ||||||
|
||||||
This setting indicates whether or not to replace the current configuration | ||||||
with the rescue configuration. | ||||||
|
||||||
The default value is `False` | ||||||
|
||||||
### config_manager_delete_rescue | ||||||
|
||||||
This setting indicates whether or not the to delete the rescue configuration | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
checkpoint that is already set. | ||||||
|
||||||
The default value is `False` | ||||||
|
||||||
## Notes | ||||||
|
||||||
None |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,31 @@ | ||||||
--- | ||||||
argument_spec: | ||||||
ansible_network_provider: | ||||||
description: | ||||||
- This value is used to determine the correct role to implement the | ||||||
load_config function. The network device provider role is responsible | ||||||
for performing the actual implementation of the load_config function. | ||||||
The specified role must be installed and accesible via the configured | ||||||
ansible_role_path setting. | ||||||
required: True | ||||||
|
||||||
config_manager_set_rescue: | ||||||
descriptiion: | ||||||
- This setting indicates whether or not the to set the current running | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
configuration as the rescue configuration. | ||||||
type: bool | ||||||
default: False | ||||||
|
||||||
config_manager_delete_rescue: | ||||||
descriptiion: | ||||||
- This setting indicates whether or not the to delete the rescue configuration | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
checkpoint that is already set. | ||||||
type: bool | ||||||
default: False | ||||||
|
||||||
config_manager_load_rescue_config: | ||||||
descriptiion: | ||||||
- This setting indicates whether or not to replace the current configuration | ||||||
with the rescue configuration. | ||||||
type: bool | ||||||
default: False |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
- load | ||
- save | ||
- noop | ||
- rescue | ||
|
||
- name: validate the requested function is supported | ||
fail: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
- name: validate role spec | ||
validate_role_spec: | ||
spec: rescue_spec.yaml | ||
|
||
- name: invoke network provider | ||
include_role: | ||
name: "{{ ansible_network_provider }}" | ||
tasks_from: config_manager/rescue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.