-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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 master config defining *static custom* data values. #12916
Comments
This has been possible for quite some time, via config.get. So long as the key you are looking up is not defined in grains, pillar, or a minion config file, the master config file will return a value for the specified key. It also can traverse multi-level dictionaries. |
Here's an example:
|
@terminalmage thanks! Actually, I was even close - I noticed before that master does not complain if any arbitrary data is defined inside its config file. But I was only able to access this data on minions that time (using Use case rewrittenThis is a rewritten use case from above:
I consider the feature request is closed at least for me. NoteThe only thing which could be done is emphasis or warning in the documentation regarding It took me some time to realize why |
Custom grains should be available in the top file. How are you defining them? |
My bad - I wasn't precise. The problem with example was posted in the beginning of this topic. |
So the remaining piece that needs to be done for this issue is adding master-side availability of the grains for orchestration files? |
@basepi Function However, If someone needs the same functionality he may also find it difficult to discover this function. So, I would expect to see this for consistency in the far future. The most intuitive implementation is to make master-side grains be actually available through the same
And, thanks to
Since there is a workaround, if the issue is closed, I won't complain. |
I think I'm going to close it for now. If another user hits this use case, we may decide to implement it. |
After almost a year I got somewhat addicted to use
even beyond the top files (as I initially needed). I try to limit its use but this is the only way to parameterise pillar (jinja) template files by centralized data (which is Salt master config file in this case) - see example I think it is remotely related to #6955 (impossible to read data from one pillar by another) because I effectively use Salt master config to inject and access variables into pillar template file. If I was able to get these variables from another pillar (not from Salt master config), I wouldn't need to resort to |
I think publishing of master config to all the minions is a security issue and stupid feature. Why do minions must see master config ? Why not to publish master's private key and /etc/shadow ? |
@Z9n2JktHlZDmlhSvqc9X2MmL3BwQG7tk, what you probably mean by "without assigning to any minion" is available for all minions. I've already mentioned issue #6955 in my previous comment above - specifically, that comment there. So, workaround by exposing Salt master config file (discussed above) which I used before is no longer needed (and, by the way, this issue was closed). Now, based on the comment (again) loading a file with data (expressed in YAML, or JSON, or ...) into a pillar allows resolving all raised issues:
Take a look at the few examples in follow-up comments from the comment there (again) to make it less abstract. I also find it a bit hacky (it's definitely not a first class feature) but the discovery solves small-scale problems now before advent of the perfect future. Personally, what I think is sure is that there is no reason for yet another data source (in addition to grains and pillars). If you look closely into "just some master data" and its use case defined by you, I don't see how this is different from a pillar which is simply assigned to all Let me know if I miss any point. |
This was initially named as "custom static master grains" in Salt-users group due to similarity with "custom static minion grains".
The main difference between the two:
/etc/salt/master
./etc/salt/minion
.Let's assume for now this custom data is accessed by name
config
(similar tograins
orpillar
) in all Salt SLS files.Why
The irreplaceable property of
config
is the ability to parameterize SLS files processed by master:/srv/salt/top.sls
,/srv/pillar/top.sls
, ...).salt-run
, (for example, see orchestration).All these files processed by master (not minion). And master does not have static custom configuration values like
grains
for minions (master hasgrains
but they cannot contain static custom values). Therefore, compared to minions, templates rendered by master are limited in sources for parameters (neither customgrains
exists, nor other data likepillars
because it is yet to be compiled).Use case
Let's assume several identical server farms managed by their own master. They all use the same sources for their states (
file_roots
) and data (pillar_roots
). However, each server farms needs slightly different configuration data inpillar
provided from the sources:Using
grains
instead ofconfig
would not work because this ispillar
's top file which is rendered by master while mastergrains
cannot have custom values likeproject
.The solution would be defining single custom value inside each master configuration file:
The text was updated successfully, but these errors were encountered: