salt.returners.slack_webhook_return

Return salt data via Slack using Incoming Webhooks

codeauthor

Carlos D. Álvaro <[email protected]>

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

slack_webhook.webhook (required, the webhook id. Just the part after: 'https://hooks.slack.com/services/')
slack_webhook.success_title (optional, short title for succeeded states. By default: '{id} | Succeeded')
slack_webhook.failure_title (optional, short title for failed states. By default: '{id} | Failed')
slack_webhook.author_icon (optional, a URL that with a small 16x16px image. Must be of type: GIF, JPEG, PNG, and BMP)
slack_webhook.show_tasks (optional, show identifiers for changed and failed tasks. By default: False)

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_webhook.webhook
slack_webhook.success_title
slack_webhook.failure_title
slack_webhook.author_icon
slack_webhook.show_tasks

Slack settings may also be configured as:

slack_webhook:
  webhook: T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
  success_title: '[{id}] | Success'
  failure_title: '[{id}] | Failure'
  author_icon: https://platform.slack-edge.com/img/default_application_icon.png
  show_tasks: true

alternative.slack_webhook:
  webhook: T00000000/C00000000/YYYYYYYYYYYYYYYYYYYYYYYY
  show_tasks: false

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

salt '*' test.ping --return slack_webhook

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

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

salt.returners.slack_webhook_return.returner(ret)

Send a slack message with the data through a webhook :param ret: The Salt return :return: The result of the post

© 2021 SaltStack.
Licensed under the Apache License, Version 2.0.
https://docs.saltproject.io/en/latest/ref/returners/all/salt.returners.slack_webhook_return.html