Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global Variables #64

Closed
PackeTsar opened this issue Apr 8, 2020 · 3 comments
Closed

Global Variables #64

PackeTsar opened this issue Apr 8, 2020 · 3 comments

Comments

@PackeTsar
Copy link
Owner

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.

@PackeTsar
Copy link
Owner Author

PackeTsar commented Apr 8, 2020

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}}

@derek-shnosh
Copy link
Collaborator

Will it be possible to set the Global keystore to an external CSV file, similarly to other external keystores?

@PackeTsar
Copy link
Owner Author

Added to enhancement tracking. Closing for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants