Skip to content

Commit 63ccbb7

Browse files
committed
Added documentation for git sync
1 parent 76e876e commit 63ccbb7

File tree

1 file changed

+42
-28
lines changed

1 file changed

+42
-28
lines changed

README.md

Lines changed: 42 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,42 @@ The plugin can be used in addition to the built-in script support and does not d
3232
|----------------|----------------|
3333
| 3.5 | 0.1.0 |
3434

35+
36+
## Installing
37+
38+
Add the plugin to `local_requirements.txt` or `plugin_requirements.txt` (netbox-docker):
39+
40+
```
41+
netbox-script-manager
42+
```
43+
44+
Enable the plugin in `/opt/netbox/netbox/netbox/configuration.py`,
45+
or if you use netbox-docker, your `/configuration/plugins.py` file:
46+
47+
```python
48+
PLUGINS = [
49+
'netbox_script_manager'
50+
]
51+
52+
PLUGINS_CONFIG = {
53+
"netbox_script_manager Manager": {
54+
"SCRIPT_ROOT": "/path/to/script/folder/",
55+
"DEFAULT_QUEUE": "high"
56+
},
57+
}
58+
```
59+
60+
## Configuration
61+
62+
The following options are required:
63+
64+
* `SCRIPT_ROOT`: Path to the script folder containing the customscripts module.
65+
66+
The following options are optional:
67+
68+
* `DEFAULT_QUEUE`: Specifies what queue scripts are run in by default. Defaults to the `default` queue.
69+
70+
3571
## Migrating scripts
3672

3773
The most important change is to change the import and name of the base `Script` class.
@@ -88,40 +124,18 @@ A folder structure like this is required (`SCRIPT_ROOT` pointing to the `netboxs
88124

89125
The reason for requiring this layout with a `customscripts` folder is to avoid name collisions when dynamically loading scripts. It also makes it easier to clear the internal python module cache which is needed for reloading scripts.
90126

91-
## Installing
92-
93-
Add the plugin to `local_requirements.txt` or `plugin_requirements.txt` (netbox-docker):
94-
95-
```
96-
netbox-script-manager
97-
```
98-
99-
Enable the plugin in `/opt/netbox/netbox/netbox/configuration.py`,
100-
or if you use netbox-docker, your `/configuration/plugins.py` file:
101-
102-
```python
103-
PLUGINS = [
104-
'netbox_script_manager'
105-
]
106-
107-
PLUGINS_CONFIG = {
108-
"netbox_script_manager Manager": {
109-
"SCRIPT_ROOT": "/path/to/script/folder/",
110-
"DEFAULT_QUEUE": "high"
111-
},
112-
}
113-
```
114127

115-
## Configuration
128+
## Git Sync
116129

117-
The following options are required:
130+
> :grey_exclamation: git must be installed on the system
118131
119-
* `SCRIPT_ROOT`: Path to the script folder containing the customscripts module.
132+
> :grey_exclamation: The netbox user must have the `sync` additional action for the `Script Instance` permission
120133
121-
The following options are optional:
134+
> :warning: git recurses parent directories until finding a git directory. Make sure the `SCRIPT_ROOT` is a git directory.
122135
123-
* `DEFAULT_QUEUE`: Specifies what queue scripts are run in by default. Defaults to the `default` queue.
136+
Netbox Script Manager has basic support for pulling down changes for git repositories. The Sync button is located on the script list and simply calls `git pull` on in the `SCRIPT_ROOT/customscripts` folder. If the git reposity requires authentication, it's recommended to setup SSH auth for the repo and provide the key in the users `$HOME/.ssh` folder.
124137

138+
If more advanced syncing is required, its recommended to handle this outside of netbox or alternatively use a custom script to do the sync.
125139

126140
## Screenshots
127141

0 commit comments

Comments
 (0)