Question

I want to use a salt formula which is configured by pillar (the Nagios formula). Example pillar file:

nagios:
  log_file: /var/nagios/nagios.log
  resource_file: /etc/nagios/resource.cfg

nrpe:
  nagios_server: 127.0.0.1
  include_dir: conf.d/

Since I also configure the Nagios server with salt, I would like to set the nagios_server IP to the IP of the minion. This seems like a job for salt mine, but getting data from the mine seems to be only supported in formula templates (not in pillar) as described in this Github Issue.

Because it is not supported to access mine data in pillar but it's a common use case to configure a minion based on data from another minion what is the correct way to do this? Should the data be put directly into the formula (where salt mine may be used). This seems to be the wrong place for such data (especially sensitive data).

Update:

After thinking a bit about the problem, I think the right thing would be to put the query to the data in salt mine into the formula. Then, the data will be fetched from the mine when the formula is executed. Is this the right way?

Was it helpful?

Solution

Yes, I'd recommend putting the query for the ip address in the formula.

EDIT:

Here's an example:

https://gist.github.com/UtahDave/5217462

In particular, look at the second file there iptablesconfig.sls

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top