slack - Send Slack notifications

New in version 1.6.


  • The slack module sends notifications to via the Incoming WebHook integration


parameter required default choices comments
no None
Define a list of attachments. This list mirrors the Slack JSON API. For more information, see
no None
Channel to send the message to. If absent, the message goes to the channel selected for the token.
(added in 2.0)
no normal
  • normal
  • good
  • warning
  • danger
Allow text to use default colors - use the default of 'normal' to not send a custom color bar at the start of the message
no None
Slack (sub)domain for your environment without protocol. (i.e. In 1.8 and beyond, this is deprecated and may be ignored. See token documentation for information.
no None
Emoji for the message sender. See Slack documentation for options. (if icon_emoji is set, icon_url will not be used)
Url for the message sender's icon (default
no 1
  • 1
  • 0
Automatically create links for channels and usernames in msg.
no None
Message to send. Note that the module does not handle escaping characters. Plain-text angle brackets and ampersands should be converted to HTML entities (e.g. & to &) before sending. See Slack's documentation ( for more.
no None
  • full
  • none
Setting for the message parser at Slack
Slack integration token. This authenticates you to the slack service. Prior to 1.8, a token looked like 3Ffe373sfhRE6y42Fg3rvf4GlK. In 1.8 and above, ansible adapts to the new slack API where tokens look like G922VJP24/D921DW937/3Ffe373sfhRE6y42Fg3rvf4GlK. If tokens are in the new format then slack will ignore any value of domain. If the token is in the old format the domain is required. Ansible has no control of when slack will get rid of the old API. When slack does that the old format will stop working. ** Please keep in mind the tokens are not the API tokens but are the webhook tokens. In slack these are found in the webhook URL which are obtained under the apps and integrations. The incoming webhooks can be added in that area. In some cases this may be locked by your Slack admin and you must request access. It is there that the incoming webhooks can be added. The key is on the end of the URL given to you in that section.
no Ansible
This is the sender of the message.
no yes
  • yes
  • no
If no, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.


- name: Send notification message via Slack
    token: thetoken/generatedby/slack
    msg: '{{ inventory_hostname }} completed'
  delegate_to: localhost

- name: Send notification message via Slack all options
    token: thetoken/generatedby/slack
    msg: '{{ inventory_hostname }} completed'
    channel: #ansible
    username: 'Ansible on {{ inventory_hostname }}'
    link_names: 0
    parse: 'none'
  delegate_to: localhost

- name: insert a color bar in front of the message for visibility purposes and use the default webhook icon and name configured in Slack
    token: thetoken/generatedby/slack
    msg: '{{ inventory_hostname }} is alive!'
    color: good
    username: ''
    icon_url: ''

- name: Use the attachments API
    token: thetoken/generatedby/slack
      - text: Display my system load on host A and B
        color: #ff00dd
        title: System load
          - title: System A
            value: "load average: 0,74, 0,66, 0,63"
            short: True
          - title: System B
            value: 'load average: 5,16, 4,64, 2,43'
            short: True

- name: Send a message with a link using Slack markup
    token: thetoken/generatedby/slack
    msg: We sent this message using <|Ansible>!

- name: Send a message with angle brackets and ampersands
    token: thetoken/generatedby/slack
    msg: This message has &lt;brackets&gt; &amp; ampersands in plain text.


This module is flagged as stableinterface which means that the maintainers for this module guarantee that no backward incompatible interface changes will be made.


This module is community maintained without core committer oversight.

For more information on what this means please read Module Support

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Helping Testing PRs and Developing Modules.