# Slack Callback Plugin Usage

**URL:** <https://forum.ansible.com/t/slack-callback-plugin-usage/26243>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [December 10, 2017, 11:26pm UTC](https://forum.ansible.com/t/slack-callback-plugin-usage/26243 "2017-12-10T23:26:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrew.sumner](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@andrew.sumner](https://forum.ansible.com/u/andrew.sumner)\
**Post date:** [December 10, 2017, 11:26pm UTC](https://forum.ansible.com/t/slack-callback-plugin-usage/26243/1 "2017-12-10T23:26:30Z")

</div>

I’m trying to use the Slack callback plugin ([https://docs.ansible.com/ansible/devel/plugins/callback/slack.html](https://docs.ansible.com/ansible/devel/plugins/callback/slack.html)) in the hopes that it will send notifications as a playbook is executed and when it completes successfully or otherwise.

Unfortunately the documentation is poor bordering on non-existant. What I have been able to glean is:

1. Install prettytable python library
2. Update ansible.cfg with “callback\_whitelist = slack”  
From there it all gets a bit murky. I should be able to setup some ini entries - no idea where so I took a wild guess and added this to ansible.cfg

> [callback\_slack]  
> webhook\_url = [https://hooks.slack.com/services/](https://hooks.slack.com/services/)//  
> channel = #preprod

Which gives this error when running a playbook:

> ERROR! Unexpected Exception, this is probably a bug: ‘webook\_url’  
> the full traceback was:

> Traceback (most recent call last):  
> File “/usr/bin/ansible-playbook”, line 106, in   
> exit\_code = cli.run()  
> File “/usr/lib/python2.7/site-packages/ansible/cli/playbook.py”, line 130, in run  
> results = pbex.run()  
> File “/usr/lib/python2.7/site-packages/ansible/executor/playbook\_executor.py”, line 90, in run  
> self.\_tqm.load\_callbacks()  
> File “/usr/lib/python2.7/site-packages/ansible/executor/task\_queue\_manager.py”, line 202, in load\_callbacks  
> callback\_obj = callback\_plugin()  
> File “/usr/lib/python2.7/site-packages/ansible/plugins/callback/slack.py”, line 93, in **init**  
> self.webhook\_url = self.\_plugin\_options[‘webook\_url’]  
> KeyError: ‘webook\_url’

Apart from getting this to work my other requirement that I’m not sure how to meet is how to I set the channel to match the name of the inventory I’m deploying to? Ideally I’d set the ini setting to something like “{{ inventory\_dir|basename }}” but not sure if it would support that. Otherwise I need to set “env:SLACK\_CHANNEL” which I don’t know how to do in Ansible.

NOTE: My playbooks are targeting windows hosts.

Versions:  
ansible-playbook 2.4.0.0  
python version = 2.7.5 (default, Aug 2 2016, 04:20:16) [GCC 4.8.5 20150623 (Red Hat 4.8.5-4)]

Thanks  
Andrew

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [December 11, 2017, 3:32pm UTC](https://forum.ansible.com/t/slack-callback-plugin-usage/26243/2 "2017-12-11T15:32:27Z")

</div>

That error has been fixed as of 2.4.1. Please try upgrading and test again. 2.4.2 is the current stable release.

After upgrading, I believe everything should work as you have configured it.
