Netbox Plugin - Integrate Proxmox and Netbox
NOTE: Although the Proxbox plugin is in development, it only use GET requests and there is no risk to harm your Proxmox environment by changing things incorrectly.
Proxbox is currently able to get the following information from Proxmox:
The following table shows the Netbox and Proxmox versions compatible (tested) with Proxbox plugin.
netbox version | proxmox version | proxbox version |
---|---|---|
>= v3.4.0 | >= v6.2.0 | =v0.0.5 |
>= v3.2.0 | >= v6.2.0 | =v0.0.4 |
>= v3.0.0 < v3.2 | >= v6.2.0 | =v0.0.3 |
The instructions below detail the process for installing and enabling Proxbox plugin. The plugin is available as a Python package in pypi and can be installed with pip.
Enter Netbox's virtual environment.
source /opt/netbox/venv/bin/activate
Install the plugin package.
(venv) $ pip install netbox-proxbox
OBS: This method is recommend for testing and development purposes and is not for production use.
Move to netbox main folder
cd /opt/netbox/netbox
Clone netbox-proxbox repository
git clone https://github.com/netdevopsbr/netbox-proxbox.git
Install netbox-proxbox
cd netbox-proxbox
source /opt/netbox/venv/bin/activate
python3 setup.py develop
Enable the plugin in /opt/netbox/netbox/netbox/configuration.py:
PLUGINS = ['netbox_proxbox']
The plugin's configuration is also located in /opt/netbox/netbox/netbox/configuration.py:
Replace the values with your own following the Configuration Parameters section.
OBS: You do not need to configure all the parameters, only the one's different from the default values. It means that if you have some value equal to the one below, you can skip its configuration. For netbox you should ensure the domain/port either targets gunicorn or a true http port that is not redirected to https.
PLUGINS_CONFIG = {
'netbox_proxbox': {
'proxmox': {
'domain': 'proxbox.example.com', # May also be IP address
'http_port': 8006,
'user': 'root@pam', # always required
'password': 'Strong@P4ssword', # only required, if you don't want to use token based authentication
'token': {
'name': 'tokenID', # Only type the token name and not the 'user@pam:tokenID' format
'value': '039az154-23b2-4be0-8d20-b66abc8c4686'
},
'ssl': False
},
'netbox': {
'domain': 'localhost', # Ensure localhost is added to ALLOWED_HOSTS
'http_port': 8001, # Gunicorn port.
'token': '0dd7cddfaee3b38bbffbd2937d44c4a03f9c9d38',
'ssl': False, # There is no support to SSL on Netbox yet, so let it always False.
'settings': {
'virtualmachine_role_id' : 0,
'node_role_id' : 0,
'site_id': 0
}
}
}
Probably on the next release of Netbox, it will not be necessary to make the configuration below! As the Pull Request #8733 got merged to develop branch
It is no longer necessary to modify the templates section in settings.py
and you may revert any changes.
(venv) $ cd /opt/netbox/netbox/
(venv) $ python3 manage.py migrate
Restart the WSGI service to load the new plugin:
# sudo systemctl restart netbox
The following options are available:
proxmox
: (Dict) Proxmox related configuration to use proxmoxer.
proxmox.domain
: (String) Domain or IP address of Proxmox.
proxmox.http_port
: (Integer) Proxmox HTTP port (default: 8006).
proxmox.user
: (String) Proxmox Username.
proxmox.password
: (String) Proxmox Password.
proxmox.token
: (Dict) Contains Proxmox TokenID (name) and Token Value (value).
proxmox.token.name
: (String) Proxmox TokenID.
proxmox.token.value
: (String) Proxmox Token Value.
proxmox.ssl
: (Bool) Defines the use of SSL (default: False).
netbox
: (Dict) Netbox related configuration to use pynetbox.
netbox.domain
: (String) Domain or IP address of Netbox. Ensure name or ip is added to ALLOWED_HOSTS
netbox.http_port
: (Integer) Netbox HTTP PORT (default: 8001). If you are not targeting gunicorn directly make sure the HTTP port is not redirected to HTTPS by your HTTP server.
netbox.token
: (String) Netbox Token Value.
netbox.ssl
: (Bool) Defines the use of SSL (default: False). - Proxbox doesn't support SSL on Netbox yet.
netbox.settings
: (Dict) Default items of Netbox to be used by Proxbox.
netbox.settings.virtualmachine_role_id
: (Integer) Role ID to be used by Proxbox when creating Virtual Machines
netbox.settings.node_role_id
: (Integer) Role ID to be used by Proxbox when creating Nodes (Devices)
netbox.settings.site_id
(Integer) Site ID to be used by Proxbox when creating Nodes (Devices)
To get Proxmox ID, Node and Type information, is necessary to configure Custom Fields. Below the parameters needed to make it work:
Required values (must be equal)
Optional values (may be different)
Required values (must be equal)
Optional values (may be different)
Required values (must be equal)
Optional values (may be different)
If everything is working correctly, you should see in Netbox's navigation the Proxmox VM/CT button in Plugins dropdown list.
On Proxmox VM/CT page, click button
It will redirect you to a new page and you just have to wait until the plugin runs through all Proxmox Cluster and create the VMs and CTs in Netbox.
OBS: Due the time it takes to full update the information, your web brouse might show a timeout page (like HTTP Code 504) even though it actually worked.
Developing tools for this project based on ntc-netbox-plugin-onboarding repo.
Issues and pull requests are welcomed.