|
| 1 | +# Registering a Device or VM |
| 2 | + |
| 3 | +Registering a device with Nazara is as straight forward as |
| 4 | +[setting up the config file](./configuration.md) and running |
| 5 | +a simple command. |
| 6 | + |
| 7 | +~~~admonish info |
| 8 | +Please make sure you have `sudo` privileges on the machine or VM you want to register, otherwise |
| 9 | +DMI information collection **will fail**. |
| 10 | +~~~ |
| 11 | + |
| 12 | +## Example Registration Workflow (Physical Device) |
| 13 | + |
| 14 | +On a physical device, a example registration workflow may look like this: |
| 15 | + |
| 16 | +### 1. Set up Configuration |
| 17 | + |
| 18 | +The user wrote a configuration file at `/root/.config/nazara/config.toml` |
| 19 | + |
| 20 | +~~~admonish example title="Example: Device Config" collapsible=true |
| 21 | +```toml |
| 22 | +# Configuration parameters for the NetBox connection |
| 23 | +[netbox] |
| 24 | +netbox_api_token = "XXXXXXXX" |
| 25 | +netbox_uri = "https://netbox.organisation.com" |
| 26 | +
|
| 27 | +# Common settings that always have to be provided |
| 28 | +[common] |
| 29 | +# The name of the device/VM |
| 30 | +name = "user@" |
| 31 | +description = "" |
| 32 | +# A comment left by Nazara if anything gets modified by it. |
| 33 | +comments = "Automatically registered by Nazara." |
| 34 | +# The current status of the device/VM |
| 35 | +status = "active" |
| 36 | +primary_ip4 = "192.168.0.1" |
| 37 | +primary_ip6 = "" |
| 38 | +
|
| 39 | +# --------------------------------------------------------------- |
| 40 | +# Use [device] for devices, or [vm] if this is a virtual machine. |
| 41 | +# --------------------------------------------------------------- |
| 42 | +
|
| 43 | +[device] |
| 44 | +device_type = 1 |
| 45 | +role = 1 |
| 46 | +site = 1 |
| 47 | +``` |
| 48 | +
|
| 49 | +The configuration file for a VM looks quite similarly. For a list |
| 50 | +of allowed config parameters, please refer to our [template](https://github.com/The-Nazara-Project/Nazara/blob/main/src/configuration/config_template.toml). |
| 51 | +
|
| 52 | +You can verify the integrity of your config by running `nazara check-config`. |
| 53 | +~~~ |
| 54 | + |
| 55 | +### 2. Run `nazara register` |
| 56 | + |
| 57 | +To register your device, simply run |
| 58 | + |
| 59 | +```bash |
| 60 | +nazara register |
| 61 | +``` |
| 62 | + |
| 63 | +### Common Issues |
| 64 | + |
| 65 | +#### TOML Deserialization Error |
| 66 | + |
| 67 | +This is most likely an issue with your config file. |
| 68 | +Make sure it has correct TOML syntax and all the fields |
| 69 | +specified in the template are present in your example. |
| 70 | + |
| 71 | +#### Unexpected Response |
| 72 | + |
| 73 | +We know this output is ugly but please bear with us we are on it. |
| 74 | +Check the output for a status code: |
| 75 | + |
| 76 | +- **400 - Bad Request**: |
| 77 | + This usually means that Nazara's payload was rejected by NetBox. Most commonly |
| 78 | + this means that you want to assign this device to a role, device type or site |
| 79 | + that does not exist (invalid ID). It can also mean that the device already exists |
| 80 | + so check if a device with the configured name has already been registered. |
| 81 | + |
| 82 | +#### File OP error |
| 83 | + |
| 84 | +This usually indicates that Nazara cannot open the config file at `/root/.config/nazara/config.toml` |
| 85 | +it's either missing, or you forgot to run Nazara as root. |
| 86 | + |
| 87 | +~~~admonish bug title="Any missing?" |
| 88 | +You have issues with registering your device and don't know how to proceed? |
| 89 | +
|
| 90 | +This could be a bug! Please [report it](http://github.com/The-Nazara-Project/Nazara/issues). |
| 91 | +~~~ |
0 commit comments