Ansible slack callback plugin - not working - please help

548 views
Skip to first unread message

Vinod Kumar

unread,
Jul 23, 2018, 11:56:07 AM7/23/18
to Ansible Project
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 = <my webhook>



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

Vinod Kumar

unread,
Jul 24, 2018, 5:32:46 AM7/24/18
to Ansible Project
Please provide me an update on this.

Regards,
Vinod Kumar.

Brian Coca

unread,
Jul 24, 2018, 9:36:47 AM7/24/18
to Ansible Project
You seem to have a version mismatch between ansible and the slack plugin




--
----------
Brian Coca

Vinod Kumar

unread,
Jul 24, 2018, 10:42:36 AM7/24/18
to Ansible Project
Hi Brain,

Thanks for the reply.

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

Brian Coca

unread,
Jul 24, 2018, 11:07:19 AM7/24/18
to Ansible Project
> 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

--
----------
Brian Coca

Vinod Kumar

unread,
Jul 25, 2018, 9:25:40 AM7/25/18
to Ansible Project
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

Vinod Kumar

unread,
Jul 26, 2018, 5:56:44 AM7/26/18
to Ansible Project
Hi All,

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

Regards,
Vinod.

Tony Chia

unread,
Aug 7, 2018, 11:12:19 AM8/7/18
to Ansible Project
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

Matt Martz

unread,
Aug 7, 2018, 11:15:00 AM8/7/18
to ansible...@googlegroups.com
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.

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/7053751e-c854-481c-a1c1-df95f7d45978%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Matt Martz
@sivel
sivel.net

Sreenivas Chokkarapu

unread,
Mar 21, 2019, 7:49:13 AM3/21/19
to Ansible Project
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.

Sreenivas Chokkarapu

unread,
Mar 21, 2019, 12:55:21 PM3/21/19
to Ansible Project
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
Reply all
Reply to author
Forward
0 new messages