Templates are designed to store configuration that can be reused by some or all the devices in the system.
Updating the configuration stored in a template allows to update the configuration of all the devices that have that template assigned.
This means that configuration can be defined only once for multiple devices, and if the need to update a specific piece of configuration arises, it can be easily achieved by updating the template.
Template ordering and override¶
A device can use multiple templates, the order in which templates are assigned to each device matters: templates assigned last can override templates assigned earlier, the order can be changed by drag and dropping the template in the device configuration page as in the animated screenshot below.
The device configuration can also override what is defined in templates.
Overriding means redefining a specific configuration section in a way that overwrites the template.
Overriding involves some form of duplication of information, which is not great, it should be used as a last resort. The recommended way to define parts of the configuration that are specific for each device is to use Configuration variables.
When templates are flagged as “Enabled by default”, they will be automatically assigned to new devices.
This is a very powerful feature: once default templates are correctly configured to implement the use case you need, you will only have to register a device into OpenWISP for it to auto-configure itself.
Moreover, you can change the default templates any time you need, which is the reason this feature has replaced the practice of storing default configuration in firmware images (which would need to be recompiled and redistributed): with default templates, the default firmware image only needs to contain the bare minimum configuration to connect to OpenWISP, once the device connects to OpenWISP it will download and apply the default templates without the need of manual intervention from the network operators.
An organization specific template flagged as default will be automatically assigned to any new device which will be created in the same organization.
A shared default template instead will be automatically assigned to all the new devices which will be created in the system, regardless of organization.