deployment notifications - for all cases - OK and failed.

Hello!

Can you please advice the best way - for sending notifications , if role failed on several hosts ?

We have implemented slack notifications about successfully deployed hosts, but how we can get list of failed hosts , and also send notifications ?

Seem’s if host failed, on last step we just not have information about it.

Here is out role:

Hi,

Maybe Slack callback plugin would work better for you?

Enable it by adding slack to the callback_whitelist in /etc/ansible/ansible.cfg
http://docs.ansible.com/ansible/intro_configuration.html#callback-whitelist

Here's documentation from the plugin itself:
https://github.com/ansible/ansible/pull/13408/files
    This is an ansible callback plugin that sends status
    updates to a Slack channel during playbook execution.

    This plugin makes use of the following environment variables:
        SLACK_WEBHOOK_URL (required): Slack Webhook URL
        SLACK_CHANNEL (optional): Slack room to post in. Default: ansible
        SLACK_USERNAME (optional): Username to post as. Default: ansible
        SLACK_INVOCATION (optional): Show command line invocation
                                      details. Default: False

    Requires:
        prettytable
CONFIDENTIALITY NOTICE: This message is the property of International Game Technology PLC and/or its subsidiaries and may contain proprietary, confidential or trade secret information. This message is intended solely for the use of the addressee. If you are not the intended recipient and have received this message in error, please delete this message from your system. Any unauthorized reading, distribution, copying, or other use of this message or its attachments is strictly prohibited.

Thanks,

I have tried, but got :

`
[WARNING]: Could not submit message to Slack: HTTP Error 404: Not Found

`

error

Can you please advise, what else can be wrong here?

$ source .slack
$ more .slack
`
SLACK_WEBHOOK_URL=https://hooks.slack.com/services/aaa/bbb/ccc
export SLACK_WEBHOOK_URL

$ grep slack ansible.cfg
callback_whitelist = slack
`

I’ve got the reason of 404 error. Seem’s that

  • SLACK_CHANNEL (optional): Slack room to post in. Default: ansible

is not optional - as we have not special ansible channel in our slack , we use another channel for testing deploys notification.

So callback start sending messages to slack only after specifying another channel via env.

It seem’s strange, because SLACK_WEBHOOK_URL at fact issued to some default channel, but if it’s not ansible - you will get such 404 error.