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,64 @@
# Get configuration from device
The Config Manager role provides a function that will connect to the remote
network device and retrieve, by default, the current device active (running)
configuration. The configuration will be returned to the calling playbook as a
fact in the device host facts. The returned text based configuration can be
accessed via `config_manager.config` fact.
## How to use this function
The examples below demonstrate how to use this function in a playbook.
### How to get the device configuration
To retrieve the current active configuration from the device, simply include
the `ansible-network.config_manager` role and execute the `get` function.
Below is an example of calling the `get` function from the playbook.
```
---
- hosts: network
gather_facts: false
roles:
- name ansible-network.config_manager
function: get
```
The example playbook above will return the current active configuration for
each device in the inventory group `network`.
### How to get the device configuration from tasks
The `get` function can also be includes in the playbook `Tasks:` section and
executed as part of the list of tasks. Below is an example of how to retrieve
the configuration using tasks.
```
---
- hosts: network
gather_facts: false
tasks:
- name: get active configuration from device
include_role:
name: ansible-network.config_manager
tasks_from: get
- name: display the device configuration to stdout
debug:
var: config_manager.config.split('\n')
```
The example playbook above will retrieve the current running configuration and
then display the configuration contents to stdout.
## Arguments
None
## Notes
None

View File

@@ -0,0 +1,91 @@
# Load configuration into device
The Config Manager role provides a function that will load configuration onto a
remote network device. The `load` function will accept the device
configuration as either text or a source file.
The `load` function provides some configurable options when pushing the
configuration to the remote device. See the `How to use this function`
section for different example of how to push configurations to network devices.
## How to use this function
The examples below demonstate how to use this function in a playbook.
## How to load and merge a configuration
Loading a configuration onto a target device is fairly simple and
straightforward. By default, the `load` function will merge the contents of
the provided configuration file with the configuration running on
the target device.
Below is an example of how to call the `load` function.
```
- hosts: network
gather_facts: false
roles:
- name: ansible-network.config_manager
function: load
config_manager_file: device.cfg
```
The example playbook above will simple load the contents of `device.cfg` onto the
target network devices and merge the configurations.
## How to load and replace a configuration
Similar to the merge capabilities, this role also supports replacing the
current device configuration on the remote target. In order to tell the `load`
function to replace the entire configure on the remote device with the provided
configuration, set the `config_manager_replace` value to True.
```
- hosts: network
gather_facts: false
roles:
- name: ansible-network.config_manager
function: load
config_manager_file: device.cfg
config_manager_replace: True
```
The example playbook above will load the file specified by
`config_manager_file` and replace the configuration on the remote device.
## Arguments
### config_manager_file
This setting provides the path to the configuration file to use as input for
loading a configuration onto a remote device. This setting can either be a
full path to the configuration file or a relative to the playbook root path.
The `config_manager_file` setting is mutually exclusive with the
`config_manager_text` setting.
The default value is `None`
### config_manager_text
This setting can be used to pass the device configuration file text in directly
instead of using a file. This configuration text is then passed directly to
the platform for implementation. The `config_manager_text` setting is mutually
exclusive with the `config_manager_file` setting.
The default value is `None`
### config_manager_replace
When this value is set to True, the provided configuration text will replace
the current configuration on the target node. If this value is set to False,
then the configuration provided is merged with the configuration running on the
target device.
The default value is `False`
## Notes
None

View File

@@ -0,0 +1,34 @@
# Save active configuration to startup
For network platforms that support saving the current active (running)
configuration to non-volatile storage, the Config Manager `save` function can
be invoked. This function will issue the save command on the target platform
regardless of whether or not the active configuration has changed.
If the target platform does not support the `save` function, then it should
simply return a NOOP.
## How to save the active configuration
To save the current active configuration to the startup configuration simply
invoke the `save` function on the target device. There are no additional
configuration options for this function.
Below is an example of calling the `save_config` function from the playbook.
```
- hosts: network
gather_facts: false
roles:
- name ansible-network.arista_eos
function: save
```
## Arguments
None
## Notes
None