An engine that reads messages from Slack and can act on them.
It has two major uses.
controlparameter is set to
Trueand 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 command
fire_allis 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
tagconfig option (defaults to
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: - *
In order to use this, the engine must be running as a minion running on
the master, so that the
Caller client can be used to retrieve that
minions pillar data, because the master process does not have pillars.
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