[英]SaltStack Can't get Master config variables to minion
New to SaltStack. 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).
我正在编写盐的自定义返回器,但小仆似乎无法看到在主服务器(/ 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? 我必须启用将配置传递给minion的功能吗?
Returners run on minions, therefore they are configured in the minion configuration. 返回器在小兵上运行,因此它们在小兵配置中配置。 See for example the Kafka returner .
参见例如Kafka返回器 。
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.
这样,您应该能够更新它而无需重新启动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). 主配置中有一个名为“
pillar_opts
的选项,该选项允许主配置值在各子午线上可用(请参见下面的Utah_Dave的答案)。 But as this publishes all master configuration values to the minions it can be a security issue. 但是,由于这会将所有主配置值发布到各部分,因此可能是一个安全问题。
There's an option in the master config named pillar_opts
whose default was recently changed from True
to False
. 主配置中有一个名为
pillar_opts
的选项,最近默认值从True
更改为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. 如果将
pillar_opts
设置为True
并重新启动salt-master守护程序,则应该在主配置中看到可用于各pillar_opts
的选项。
It was changed to default to False
because many users didn't want the minions to see all the master's config options. 由于许多用户不希望奴才看到所有主人的配置选项,因此将其默认更改为
False
。
Like ahus1 mentions, you may want to put that configuration in pillar data or the minion config. 就像提到ahus1一样,您可能希望将该配置放入支柱数据或minion配置中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.