Destroyed Initializers (markdown)

Tobias Genannt 2022-09-01 12:57:00 +02:00
parent 7c08e548de
commit 10af808ec8

@ -1,49 +0,0 @@
Initializers are built-in [startup scripts](Startup-Scripts) for defining NetBox custom fields, groups, users and many other resources in YAML files. Just edit the files in the `initializers` folder to get started. See below for a cleaner solution.
Here's an example for defining a custom field:
```yaml
# initializers/custom_fields.yml
text_field:
type: text
label: Custom Text
description: Enter text in a text field.
required: false
filter_logic: loose
weight: 0
on_objects:
- dcim.models.Device
- dcim.models.Rack
- ipam.models.IPAddress
- ipam.models.Prefix
- tenancy.models.Tenant
- virtualization.models.VirtualMachine
```
See [startup scripts](Startup-Scripts) for how to build a Docker image baked with your own initializer files.
[netbox-docker-initializers]: https://github.com/netbox-community/netbox-docker/tree/master/initializers
[netbox-docker-compose]: https://github.com/netbox-community/netbox-docker/blob/master/docker-compose.yml
## Separate Initializers Folder
To reduce the chances of conflicts with your files when updating the NetBox Docker folder you are advised to create a separate `initializers` folder.
Begin by making a copy of the existing folder. Then edit (or create) your `docker-compose.override.yml` file. Edit the file and add/merge the following keys and value:
```yaml
version: '3.4'
services:
netbox:
volumes:
- ./my_initializers:/opt/netbox/initializers:z,ro ## <-- Replace `my_initializers` with the name of your folder
```
## Available Groups for User/Group initializers`
To get an up-to-date list about all the available permissions, run the following command.
```bash
# Make sure the 'netbox' container is already running! If unsure, run `docker-compose up -d`
echo "from django.contrib.auth.models import Permission\nfor p in Permission.objects.all():\n print(p.codename);" | docker-compose exec -T netbox ./manage.py shell
```