I wish to store my slack api key so that it will be accessible from both Reactor states as well as states executed by minions (such as when running a highstate):
slack_api_key: xxx
If I add the data to a pillar, it can only be accessible from minions executing states:
{{ salt['pillar.get']('slack_api_key') }}
If I add the data to the master config, it can only be accessible from the Reactor:
{{ opts['slack_api_key'] }}
How can I store this data and be able to access it from both the Reactor and from states included in my highstate?
One solution is to set the following in the master
configuration:
# The pillar_opts option adds the master configuration file data to a dict in
# the pillar called "master". This is used to set simple configurations in the
# master config file that can then be used on minions.
pillar_opts: True
# Slack API key
slack_api_key: 'xxx'
Then any data in the master
configuration can be accessed like this...
From minions:
{{ salt['pillar.get']('master:slack_api_key') }}
- or -
{{ pillar['master']['slack_api_key'] }}
From Reactor:
{{ opts['slack_api_key'] }}
However, this is not a great answer, as any data in the master
configuration is now exposed to minions.