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
allow pillar files to 'include'/load other pillar files. #4244
Comments
related to #4326 and discussed here: https://groups.google.com/d/topic/salt-users/gH7DHC0Ck88/discussion |
+1 |
1 similar comment
+1 |
It is stated that this should work in the docs. But it doesn't work. |
@thecodeassassin Including pillars using So instead of: base:
'node-*-web':
- pillars.db_credentials
- pillars.admin_list
- pillars.web_app You could simply include the Re-using values of other pillars inside a pillar file is not yet supported. |
This feels like quite a big issue when you start working with formulas. Because formulas use pillar data to describe everything, you then have no way to define and use values in a DRY way on top of that. For example if you're using the users formula, and you have two users with the same ssh public key, there's no way to define that key in one place and reference it in two places in the pillar data. |
+1 |
Indeed! This is pretty basic :( I don't really understand how people use Salt if that is not possible.... |
+1 |
+1 @aviau ;) |
+1 |
1 similar comment
+1 |
It's impossible to implement it that way, because to handle inclusion, you need to render a pillar file first, using a renderer (e.g. Jinja2). |
Pillars can include other pillars:
Here |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue. |
A few times in the last few months I've wanted to have pillar values that I could 'include' or load into my pillar files. The problem is that the pillar dict doesn't seem to be available at all until the pillar has completely finished loading, and pillar files don't seem to be able to include others.
One example: I have a live_instances.sls yaml file that contains a list of all my servers. I need to load this live_instances.sls file and only add to the pillar the servers that match a regex on their fqdn.
live_instances.sls:
server_status.sls:
I guess this can be accomplished currently by natively including the pillar files by using your templating language such as mako or jinja, but that seems like a hack and salt should be able to handle this natively.
I thought that maybe instad of allowing 'includes', it might be a better idea to create a 'high pillar' or some kind of pillar that is loaded before the main pillar begins to load so that the dict is available. Either way would work.
The text was updated successfully, but these errors were encountered: