community.general.rocketchat – Send notifications to Rocket Chat
Note
This plugin is part of the community.general collection (version 3.8.3).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.general
.
To use it in a playbook, specify: community.general.rocketchat
.
Synopsis
The
rocketchat
module sends notifications to Rocket Chat via the Incoming WebHook integration
Parameters
Parameter |
Comments |
---|---|
Define a list of attachments. |
|
Channel to send the message to. If absent, the message goes to the channel selected for the token specified during the creation of webhook. |
|
Allow text to use default colors - use the default of ‘normal’ to not send a custom color bar at the start of the message Choices:
|
|
The domain for your environment without protocol. (i.e. |
|
Emoji for the message sender. The representation for the available emojis can be got from Rocket Chat. (for example :thumbsup:) (if icon_emoji is set, icon_url will not be used) |
|
URL for the message sender’s icon. Default: “https://www.ansible.com/favicon.ico” |
|
Automatically create links for channels and usernames in msg. Choices:
Default: 1 |
|
Message to be sent. |
|
Specify the protocol used to send notification messages before the webhook url. (i.e. http or https) Choices:
|
|
Rocket Chat Incoming Webhook integration token. This provides authentication to Rocket Chat’s Incoming webhook for posting messages. |
|
This is the sender of the message. Default: “Ansible” |
|
If Choices:
|
Examples
- name: Send notification message via Rocket Chat
community.general.rocketchat:
token: thetoken/generatedby/rocketchat
domain: chat.example.com
msg: '{{ inventory_hostname }} completed'
delegate_to: localhost
- name: Send notification message via Rocket Chat all options
community.general.rocketchat:
domain: chat.example.com
token: thetoken/generatedby/rocketchat
msg: '{{ inventory_hostname }} completed'
channel: #ansible
username: 'Ansible on {{ inventory_hostname }}'
icon_url: http://www.example.com/some-image-file.png
link_names: 0
delegate_to: localhost
- name: Insert a color bar in front of the message for visibility purposes and use the default webhook icon and name configured in rocketchat
community.general.rocketchat:
token: thetoken/generatedby/rocketchat
domain: chat.example.com
msg: '{{ inventory_hostname }} is alive!'
color: good
username: ''
icon_url: ''
delegate_to: localhost
- name: Use the attachments API
community.general.rocketchat:
token: thetoken/generatedby/rocketchat
domain: chat.example.com
attachments:
- text: Display my system load on host A and B
color: #ff00dd
title: System load
fields:
- title: System A
value: 'load average: 0,74, 0,66, 0,63'
short: True
- title: System B
value: 'load average: 5,16, 4,64, 2,43'
short: True
delegate_to: localhost
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
A flag indicating if any change was made or not. Returned: success Sample: false |
Authors
Ramon de la Fuente (@ramondelafuente)