SaltStack Can't get Master config variables to minion

Question:

New to SaltStack. I’m writing a custom returner for salt but the minion does not seem to be able to see config variables set in the master (/etc/salt/master). I have things like connection info which need to be passed to the minion.

__salt__['config.option']('returner.myconfig.test')

comes back empty and so does this

__opts__.get('returner.myconfig.test', None)

is there something I have to enable to pass configs to minion?

Asked By: kwakhed

||

Answers:

Returners run on minions, therefore they are configured in the minion configuration. See for example the Kafka returner.

The minion configuration is read on the minion’s start, therefore it is difficult to update.

As you write a custom returner: consider putting the configuration in a pillar instead. This way you should be able to update it without restarting the minion.

There’s an option in the master config named pillar_opts that allow master configuration values to be available on the minons (see Utah_Dave’s answer below). But as this publishes all master configuration values to the minions it can be a security issue.

Answered By: ahus1

There’s an option in the master config named pillar_opts whose default was recently changed from True to False.

If you set pillar_opts to True and restart the salt-master daemon you should see the options in the master config made available to the minions.

It was changed to default to False because many users didn’t want the minions to see all the master’s config options.

Like ahus1 mentions, you may want to put that configuration in pillar data or the minion config.

Answered By: Utah_Dave
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.