1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00
Files
netbox-community-netbox/docs/models/extras/configtemplate.md
Jeremy Stretch 73a7a2d27a Closes #11559: Implement config template rendering (#11769)
* WIP

* Add config_template field to Device

* Pre-fetch referenced templates

* Correct up_to_date callable

* Add config_template FK to Device

* Update & merge migrations

* Add config_template FK to Platform

* Add tagging support for ConfigTemplate

* Catch exceptions when rendering device templates in UI

* Refactor ConfigTemplate.render()

* Add support for returning plain text content

* Add ConfigTemplate model documentation

* Add feature documentation for config rendering
2023-02-19 20:09:52 -05:00

1.6 KiB

Configuration Templates

Configuration templates can be used to render devices configurations from context data. Templates are written in the Jinja2 language and can be associated with devices roles, platforms, and/or individual devices.

Context data is made available to devices and/or virtual machines based on their relationships to other objects in NetBox. For example, context data can be associated only with devices assigned to a particular site, or only to virtual machines in a certain cluster.

See the configuration rendering documentation for more information.

Fields

Name

A unique human-friendly name.

Weight

A numeric value which influences the order in which context data is merged. Contexts with a lower weight are merged before those with a higher weight.

Data File

Template code may optionally be sourced from a remote data file, which is synchronized from a remote data source. When designating a data file, there is no need to specify template code: It will be populated automatically from the data file.

Template Code

Jinja2 template code, if being defined locally rather than replicated from a data file.

Environment Parameters

A dictionary of any additional parameters to pass when instantiating the Jinja2 environment. Jinja2 supports various optional parameters which can be used to modify its default behavior.