Ansible slack callback plugin - not working - please help

Hi All,

I am using below slack callback configuration and getting below error. When i tried using the slack module instead of slack callback plugin, i am able to get the notification in my slack channel. But i want to use the slack callback plugin to get the ansible play over slack everytime if it is failed/successful.

Please provide your valuable inputs here in case if i am trying something wrong/missing some imp configuration. I have been testing this from last few days and asking experts in this forum to help me in resoving this issue.

Thanks in advance.

Below is the error when running the playbook.

PLAYBOOK: test.yml ****************
[WARNING]: Failure using method (v2_playbook_on_start) in callback plugin (<ansible.plugins.callback./usr/share/ansible/plugins/callback/slack.CallbackModule object at
0x7f3484454190>): ‘tags’

Callback Exception:
File “/usr/lib/python2.7/site-packages/ansible/executor/task_queue_manager.py”, line 374, in send_callback
method(*new_args, **kwargs)
File “/usr/share/ansible/plugins/callback/slack.py”, line 136, in v2_playbook_on_start
tags = self.get_option(‘tags’)
File “/usr/lib/python2.7/site-packages/ansible/plugins/callback/init.py”, line 90, in get_option
return self._plugin_options[k]

PLAY [Main ABC Playbook] ******************************************************************************************************************************************
[WARNING]: Could not submit message to Slack: HTTP Error 403: Forbidden

my ansible.cfg is configured like below for slack callback plugin.
[defaults]
callback_whitelist = slack

[callback_slack]
channel = <#Myslackchannel>
username = ansible
webhook_url =

ansible --version

ansible 2.7.0.dev0
config file = /etc/ansible/roles/auto_os_patch/ansible.cfg
configured module search path = [u’/home/user1/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’]
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /bin/ansible
python version = 2.7.5 (default, Feb 20 2018, 09:19:12) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]

I have also impoted prettytable which is one of the requirement of ansible slack callback plugin.

#python

Python 2.7.5 (default, Feb 20 2018, 09:19:12)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.

import prettytable
prettytable
<module ‘prettytable’ from ‘/usr/lib64/python2.7/site-packages/prettytable.pyc’>

Regards,

Vinod kumar

Please provide me an update on this.

Regards,
Vinod Kumar.

You seem to have a version mismatch between ansible and the slack plugin

Hi Brain,

Thanks for the reply.

Can you please help in the compatible versions which i should use to make this work.

Can you please help in the compatible versions which i should use to make this work.

the slack plugin ships with Ansible, just use the one for the version
of ansible you are executing

Hi Brain,

I have verified the slack callback and ansible versions, both are compatible and same code in the GIT repository as well. But still having the same issue.

Error message

[WARNING]: Failure using method (v2_playbook_on_start) in callback plugin (<ansible.plugins.callback./usr/lib/python2.7/site-
packages/ansible/plugins/callback/slack.CallbackModule object at 0x7f6a492eb050>): ‘tags’

Callback Exception:
File “/usr/lib/python2.7/site-packages/ansible/executor/task_queue_manager.py”, line 374, in send_callback
method(*new_args, **kwargs)
File “/usr/lib/python2.7/site-packages/ansible/plugins/callback/slack.py”, line 136, in v2_playbook_on_start
tags = self.get_option(‘tags’)
File “/usr/lib/python2.7/site-packages/ansible/plugins/callback/init.py”, line 90, in get_option
return self._plugin_options[k]

[WARNING]: Could not submit message to Slack: HTTP Error 403: Forbidden

Hi All,

Any update on this. I am still having issue regarding the callback slack plugin. Please help.

Regards,
Vinod.

The error message says HTTP Error 403: Forbidden

Are you able to use the same credential, webhook_url, etc using curl or any other tool outside of ansible?

I suspect your haven’t configured your slack channel properly

This was actually just recently resolved in devel: https://github.com/ansible/ansible/pull/43542

Backport PRs for 2.5 and 2.6 are open and waiting to be merged for the next releases.

Hello Matt,

I’m stuck with the same issue of

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

I'm using ansible 2.4.2, is it possible to get these changes into 2.4.2 release?

Regards,
Sreenivas.

I was able to resolve that 404 error; an employee who created the slack token left the company and the IT disabled it.

Thanks

Sreenivas