Continued work on feature docs
This commit is contained in:
69
docs/models/extras/configcontext.md
Normal file
69
docs/models/extras/configcontext.md
Normal file
@@ -0,0 +1,69 @@
|
||||
# Configuration Contexts
|
||||
|
||||
Sometimes it is desirable to associate additional data with a group of devices or virtual machines to aid in automated configuration. For example, you might want to associate a set of syslog servers for all devices within a particular region. Context data enables the association of extra user-defined data with devices and virtual machines grouped by one or more of the following assignments:
|
||||
|
||||
* Region
|
||||
* Site group
|
||||
* Site
|
||||
* Location (devices only)
|
||||
* Device type (devices only)
|
||||
* Role
|
||||
* Platform
|
||||
* Cluster type (VMs only)
|
||||
* Cluster group (VMs only)
|
||||
* Cluster (VMs only)
|
||||
* Tenant group
|
||||
* Tenant
|
||||
* Tag
|
||||
|
||||
## Hierarchical Rendering
|
||||
|
||||
Context data is arranged hierarchically, so that data with a higher weight can be entered to override lower-weight data. Multiple instances of data are automatically merged by NetBox to present a single dictionary for each object.
|
||||
|
||||
For example, suppose we want to specify a set of syslog and NTP servers for all devices within a region. We could create a config context instance with a weight of 1000 assigned to the region, with the following JSON data:
|
||||
|
||||
```json
|
||||
{
|
||||
"ntp-servers": [
|
||||
"172.16.10.22",
|
||||
"172.16.10.33"
|
||||
],
|
||||
"syslog-servers": [
|
||||
"172.16.9.100",
|
||||
"172.16.9.101"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
But suppose there's a problem at one particular site within this region preventing traffic from reaching the regional syslog server. Devices there need to use a local syslog server instead of the two defined above. We'll create a second config context assigned only to that site with a weight of 2000 and the following data:
|
||||
|
||||
```json
|
||||
{
|
||||
"syslog-servers": [
|
||||
"192.168.43.107"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
When the context data for a device at this site is rendered, the second, higher-weight data overwrite the first, resulting in the following:
|
||||
|
||||
```json
|
||||
{
|
||||
"ntp-servers": [
|
||||
"172.16.10.22",
|
||||
"172.16.10.33"
|
||||
],
|
||||
"syslog-servers": [
|
||||
"192.168.43.107"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Data from the higher-weight context overwrites conflicting data from the lower-weight context, while the non-conflicting portion of the lower-weight context (the list of NTP servers) is preserved.
|
||||
|
||||
## Local Context Data
|
||||
|
||||
Devices and virtual machines may also have a local config context defined. This local context will _always_ take precedence over any separate config context objects which apply to the device/VM. This is useful in situations where we need to call out a specific deviation in the data for a particular object.
|
||||
|
||||
!!! warning
|
||||
If you find that you're routinely defining local context data for many individual devices or virtual machines, custom fields may offer a more effective solution.
|
17
docs/models/extras/tag.md
Normal file
17
docs/models/extras/tag.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# Tags
|
||||
|
||||
Tags are user-defined labels which can be applied to a variety of objects within NetBox. They can be used to establish dimensions of organization beyond the relationships built into NetBox. For example, you might create a tag to identify a particular ownership or condition across several types of objects.
|
||||
|
||||
Each tag has a label, color, and a URL-friendly slug. For example, the slug for a tag named "Dunder Mifflin, Inc." would be `dunder-mifflin-inc`. The slug is generated automatically and makes tags easier to work with as URL parameters. Each tag can also be assigned a description indicating its purpose.
|
||||
|
||||
Objects can be filtered by the tags they have applied. For example, the following API request will retrieve all devices tagged as "monitored":
|
||||
|
||||
```no-highlight
|
||||
GET /api/dcim/devices/?tag=monitored
|
||||
```
|
||||
|
||||
The `tag` filter can be specified multiple times to match only objects which have _all_ of the specified tags assigned:
|
||||
|
||||
```no-highlight
|
||||
GET /api/dcim/devices/?tag=monitored&tag=deprecated
|
||||
```
|
Reference in New Issue
Block a user