An engine that reads messages from Slack and can act on them.
It has two major uses.
control
parameter is set to True
and a message is prefaced
with the trigger
(which defaults to !
) then the engine will
validate that the user has permission, and if so will run the commandfire_all
is set (defaults to False),
all other messages (the messages that aren't control messages) will be
fired off to the salt event bus with the tag prefixed by the string
provided by the tag
config option (defaults to salt/engines/slack
).This allows for configuration to be gotten from either the engine config, or from the saltmaster's minion pillar.
configuration: | Example configuration using only a 'default' group. The default group is not special. |
---|
In addition, other groups are being loaded from pillars.
engines:
- slack:
token: 'xoxb-xxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxx'
control: True
fire_all: False
groups_pillar_name: 'slack_engine:groups_pillar'
groups:
default:
users:
- *
commands:
- test.ping
- cmd.run
- list_jobs
- list_commands
aliases:
list_jobs:
cmd: jobs.list_jobs
list_commands:
cmd: pillar.get salt:engines:slack:valid_commands target=saltmaster tgt_type=list
default_target:
target: saltmaster
tgt_type: glob
targets:
test.ping:
target: '*'
tgt_type: glob
cmd.run:
target: saltmaster
tgt_type: list
configuration: | Example configuration using the 'default' group and a non-default group and a pillar that will be merged in If the user is '*' (without the quotes) then the group's users or commands will match all users as appropriate |
---|
engines:
- slack:
groups_pillar: slack_engine_pillar
token: 'xoxb-xxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxx'
control: True
fire_all: True
tag: salt/engines/slack
groups_pillar_name: 'slack_engine:groups_pillar'
groups:
default:
valid_users:
- *
valid_commands:
- test.ping
aliases:
list_jobs:
cmd: jobs.list_jobs
list_commands:
cmd: pillar.get salt:engines:slack:valid_commands target=saltmaster tgt_type=list
gods:
users:
- garethgreenaway
commands:
- *
depends: | slackclient |
---|
salt.engines.slack.
start
(token, control=False, trigger=u'!', groups=None, groups_pillar_name=None, fire_all=False, tag=u'salt/engines/slack')¶Listen to slack events and forward them to salt, new version
Docs for previous releases are available on readthedocs.org.
Latest Salt release: 2018.3.0
salt.engines.redis_sentinel module