|
| 1 | +# Usage |
| 2 | + |
| 3 | +With plugin you can push rendered configuration from NetBox to devices. |
| 4 | + |
| 5 | +Supported platforms: |
| 6 | + |
| 7 | +* `arista_eos` |
| 8 | +* `cisco_iosxe` |
| 9 | +* `cisco_iosxr` |
| 10 | +* `cisco_nxos` |
| 11 | +* `juniper_junos` |
| 12 | + |
| 13 | +Plugin using [scrapli-cfg](https://github.com/scrapli/scrapli_cfg) for this feature. |
| 14 | + |
| 15 | +## Substitutes |
| 16 | + |
| 17 | +If you render not full configuration, it is acceptable to pull missing config sections from the actual configuration to render full configuration. |
| 18 | + |
| 19 | +!!! note |
| 20 | + If you render full configuration in NetBox, you can proceed to `Configuration Request` part |
| 21 | + |
| 22 | +To do that you should create substitute. |
| 23 | + |
| 24 | +Substitutes is a "tag" that needs to be replaced with output from the real device, and a regex pattern that "pulls" this section from the actual device itself. |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | +In screenshot below we add substitute for Arista PlatformSetting |
| 29 | + |
| 30 | +* **Name** is a "tag", you should put this as jinja2 variable in your config template in NetBox |
| 31 | +* **Regexp** is a regex, that "pulls" what matched from device and replace `Name` jinja2 variable in config template |
| 32 | + |
| 33 | +In example substitute `ethernet_interfaces` section will be replaced with whatever the provided pattern finds from the real device. |
| 34 | + |
| 35 | +This pattern matches all ethernet interfaces on a Arista device. |
| 36 | + |
| 37 | +To correctly render substitute in config template you have two options: |
| 38 | + |
| 39 | +``` |
| 40 | +{{ "{{ ethernet_interfaces }}" }} |
| 41 | +``` |
| 42 | + |
| 43 | +or |
| 44 | + |
| 45 | +``` |
| 46 | +{% raw %}{{ ethernet_interfaces }}{% endraw %} |
| 47 | +``` |
| 48 | + |
| 49 | +Config template will look like: |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | +And rendered config template with substitute |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | +## Configuration Request |
| 58 | + |
| 59 | +Now you let's create `Configuration Request` with devices you want to configure. |
| 60 | + |
| 61 | +!!! warning |
| 62 | + For request only accepts devices with `Active` status and assigned Platform, Primary IP, Config Template and PlatformSetting |
| 63 | + |
| 64 | +Find `Configuration Requests` in navbar. |
| 65 | + |
| 66 | +Now collect diffs for devices pressing `Collecting diffs` button. |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | +On tab `Diffs` you can review diffs for devices. |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | +To continue approve request by pressing `Approve` button. |
| 75 | + |
| 76 | + |
| 77 | + |
| 78 | +Also you can cancel approve after that. |
| 79 | + |
| 80 | + |
| 81 | + |
| 82 | +After approval you can see by whom configuration request is approved. |
| 83 | + |
| 84 | + |
| 85 | + |
| 86 | +At this moment you can schedule job that will push rendered configuration to devices in configuration request by pressing schedule button. |
| 87 | + |
| 88 | + |
| 89 | + |
| 90 | +After that you can see by whom configuration request is scheduled and time. |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | +Also you can cancel scheduled job by pressing `Unschedule` button. |
| 95 | + |
| 96 | + |
| 97 | + |
| 98 | +!!! warning |
| 99 | + Approve and Schedule buttons is accessable only to user with `netbox_config_diff.approve_configurationrequest` |
| 100 | + permission |
| 101 | + |
| 102 | +!!! warning |
| 103 | + If you unapprove scheduled configuration request, scheduled job will be canceled |
| 104 | + |
| 105 | +After scheduled job is completed you can job logs on configuration request page. |
| 106 | + |
| 107 | + |
| 108 | + |
| 109 | +!!! note |
| 110 | + Completed configuration requests can't be edited. |
| 111 | + |
| 112 | +## Rollback |
| 113 | + |
| 114 | +If an error occurs while executing a job that pushes configurations to devices then all configured devices will be rollbacked to the previous version of the configuration. |
0 commit comments