Ansible Slack


  1. Ansible Slack
  2. Ansible Slack Integration
  3. Ansible Slack Channel
  4. Ansible Slack Emoji
  5. Ansible Tower Documentation

The slack module sends notifications to via the Incoming WebHook integration


Slack 404 ansible/ansible-modules-extras#100. Closed Copy link laurentr commented Aug 12, 2015. For what it's worth, you'll get the exact same 404 response if the. ChatOps bot for running Ansible one-liners through Slack Description. Docker image of a Slack bot that enables remote execution of Ansible commands inside a Slack channel. Enable Bot Users in your Slack team. Create a bot, retrieve its API token and invite the bot to the channels you want to monitor.

Define a list of attachments. This list mirrors the Slack JSON API. For more information, see
Channel to send the message to. If absent, the message goes to the channel selected for the token.
  • 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
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.
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
  • 1
  • 0
Automatically create links for channels and usernames in msg.
Message to send.
  • 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.
This is the sender of the message.
  • yes
  • no
If no, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.

Ansible Slack

Ansible Slack

This is an Extras Module

For more information on what this means please read Extras Modules

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

Rolling out new VLANs across a network can be time consuming. The Ansible playbook documented in this post automates the configuration and deployment for specified VLANs to a group of switches.

In our case, we use private-vlans in the 5xx range for our customers, and map these to 15xx vlans in the core network. This mapping is configured on our upstream trunk ports.

Ansible Slack

The finished playbook thus completes these tasks in this order:

  1. Configure VLANs
  2. Add VLAN's and VLAN-mapping to P010 trunk
  3. Send confirmation message to Slack channel

VLAN Configuration

To avoid manually typing out the configuration for the VLANs, I render this configuration through Ansible. First I must define how my VLAN configuration should look in my Jinja2 template:


And I can then define the VLAN properties in JSON:


This is a really nice way of doing it, as it allows me to render all of the Cisco configuration automatically, while giving me control to explicitly name my VLANs. The CUSTX naming scheme above is fabricated, and we would actually name our VLANs properly in production, however if your requirement does not necessitate uniquely naming VLANs then you can omit the JSON altogether and iterate over a pythonic range in Jinja2:

Ansible Slack

vlans.j2 (alternative)

Ansible Slack Integration

This is also a neat way of doing it.

Ansible Slack Channel

Finally, the below playbook task will render and apply the VLAN configuration:



I have set the match parameter to none, instructing ansible to not check the running config prior to executing the rendered config. Of the 4 possible options for the match parameter, this seems to be the only option that allows the task to complete successfully when one of the rendered VLANs already exist on the target equipment.

Trunk Configuration

Mapping and trunking the VLANs on our Port-Channel10 interface can be done statically like the below:

Ansible Slack


Alternatively, we can use Jinja2 to render this in a similar fashion to our VLAN configuration:


We will need to add the parents paremeter to our task to ensure this is deployed under the interface configuration:

Task (alternative)

Last of all, I like to include a Slack confirmation at the end of my playbooks. A slightly tweaked example from the Ansible Documentation will do:

Ansible Slack Emoji

And that's it! Our complete playbook will look like this:

Ansible Tower Documentation

The Playbook

Thanks for reading :)