salt.returners.slack_returner

Return salt data via slack

2015.5.0 新版功能.

The following fields can be set in the minion conf file:

.. code-block:: yaml
slack.channel (required) slack.api_key (required) slack.username (required) slack.as_user (required to see the profile picture of your bot) slack.profile (optional) slack.changes(optional, only show changes and failed states) slack.yaml_format(optional, format the json in yaml format)

Alternative configuration values can be used by prefacing the configuration. Any values not found in the alternative configuration will be pulled from the default location:

slack.channel
slack.api_key
slack.username
slack.as_user

Slack settings may also be configured as:

slack:
    channel: RoomName
    api_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    username: user
    as_user: true

alternative.slack:
    room_id: RoomName
    api_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    from_name: user@email.com

slack_profile:
    slack.api_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    slack.from_name: user@email.com

slack:
    profile: slack_profile
    channel: RoomName

alternative.slack:
    profile: slack_profile
    channel: RoomName

To use the Slack returner, append '--return slack' to the salt command.

salt '*' test.ping --return slack

To use the alternative configuration, append '--return_config alternative' to the salt command.

salt '*' test.ping --return slack --return_config alternative

To override individual configuration items, append --return_kwargs '{"key:": "value"}' to the salt command.

2016.3.0 新版功能.

salt '*' test.ping --return slack --return_kwargs '{"channel": "#random"}'
salt.returners.slack_returner.returner(ret)

Send an slack message with the data