W3cubDocs

/Ansible

rocketchat - Send notifications to Rocket Chat

New in version 2.2.

Synopsis

The rocketchat module sends notifications to Rocket Chat via the Incoming WebHook integration

Options

parameter required default choices comments
attachments
no None
Define a list of attachments.
channel
no None
Channel to send the message to. If absent, the message goes to the channel selected for the token specifed during the creation of webhook.
color
no normal
  • 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
domain
yes
The domain for your environment without protocol. (i.e. subdomain.domain.com or chat.domain.tld)
icon_emoji
no None
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)
icon_url
no https://www.ansible.com/favicon.ico
URL for the message sender's icon.
link_names
no 1
  • 1
  • 0
Automatically create links for channels and usernames in msg.
msg
no None
Message to be sent.
protocol
no https
  • http
  • https
Specify the protocol used to send notification messages before the webhook url. (i.e. http or https)
token
yes
Rocket Chat Incoming Webhook integration token. This provides authentication to Rocket Chat's Incoming webhook for posting messages.
username
no Ansible
This is the sender of the message.
validate_certs
no yes
  • yes
  • no
If no, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.

Examples

- name: Send notification message via Rocket Chat
  local_action:
    module: rocketchat
    token: thetoken/generatedby/rocketchat
    domain: chat.example.com
    msg: "{{ inventory_hostname }} completed"

- name: Send notification message via Rocket Chat all options
  local_action:
    module: 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

- name: insert a color bar in front of the message for visibility purposes and use the default webhook icon and name configured in rocketchat
  rocketchat:
    token: thetoken/generatedby/rocketchat
    domain: chat.example.com
    msg: "{{ inventory_hostname }} is alive!"
    color: good
    username: ""
    icon_url: ""

- name: Use the attachments API
  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"

Return Values

Common return values are documented here Common Return Values, the following are the fields unique to this module:

name description returned type sample
changed A flag indicating if any change was made or not. success boolean False

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, developing_test_pr and Developing Modules.

© 2012–2016 Michael DeHaan
© 2016 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/rocketchat_module.html