Global Variables
PackeTsar opened this issue · comments
A feature has been proposed which would allow a user to set globally available variables which would be passed into a template the same as a keystore's variables.
Use Case
The current use case is template portability. It may be desired to have a value in a template which would need to be changed when the template is used in a new ZTP server instance (something like the IP address of the ZTP server). It would be better to allow the user to define a global variable for this and use that variable in their templates.
Proposed Implementation
A new system-level variable would be introduced which would allow the user to designate a locally-configured keystore as the global keystore. The configuration would look something like the below.
ztp set global-keystore GLOBAL
#
#
ztp set keystore GLOBAL ztp_ip_address 10.0.0.10
ztp set keystore GLOBAL someotherkey someothervalue
The values in this keystore would be passed into a template merge regardless of what specific keystore was matched.
The values would be passed in as subordinates of the global keystore's name. For example, to retrieve the IP address variable in the template, you would call {{ GLOBAL.ztp_ip_address}}
Will it be possible to set the Global keystore to an external CSV file, similarly to other external keystores?
Added to enhancement tracking. Closing for now.