rocketchat
Send notifications to Rocket Chat
Collection: community.general
Full Name: community.general.rocketchat
Synopsis
Send notifications to Rocket Chat
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| attachments | list | Define a list of attachments. | ||
| channel | string | Channel to send the message to. If absent, the message goes to the channel selected for the O(token) specified during the creation of webhook. | ||
| color | string | normal | Allow text to use default colors - use the default of V(normal) to not send a custom color bar at the start of the message. | |
| domain | string | yes | The domain for your environment without protocol. (For example V(example.com) or V(chat.example.com)). | |
| icon_emoji | string | Emoji for the message sender. The representation for the available emojis can be got from Rocket Chat. For example V(:thumbsup:). If O(icon_emoji) is set, O(icon_url) is not used. | ||
| icon_url | string | https://docs.ansible.com/favicon/favicon.ico | URL for the message sender’s icon. | |
| is_pre740 | bool | false | If V(true), the payload matches Rocket.Chat prior to 7.4.0 format. This format has been used by the module since its inception, but is no longer supported by Rocket.Chat 7.4.0. The default value changed from V(true) to V(false) in community.general 13.0.0. This parameter is going to be removed in a future release when Rocket.Chat 7.4.0 becomes the minimum supported version. | |
| link_names | int | 1 | Automatically create links for channels and usernames in O(msg). | |
| msg | string | Message to be sent. | ||
| protocol | string | https | Specify the protocol used to send notification messages before the webhook URL (that is, V(http) or V(https)). | |
| token | string | yes | Rocket Chat Incoming Webhook integration token. This provides authentication to Rocket Chat’s Incoming webhook for posting messages. | |
| username | string | Ansible | This is the sender of the message. | |
| validate_certs | bool | true | If V(false), SSL certificates are not validated. This should only be used on personally controlled sites using self-signed certificates. |
Example
yaml
- name: Send notification message through Rocket Chat
community.general.rocketchat:
token: thetoken/generatedby/rocketchat
domain: chat.example.com
msg: '{{ inventory_hostname }} completed'
delegate_to: localhost
- name: Send notification message through 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