PARALLAX

rocketchat

Send notifications to Rocket Chat

Collection: community.general

Full Name: community.general.rocketchat

Synopsis

Send notifications to Rocket Chat

Parameters

NameTypeRequiredDefaultDescription
attachmentslistDefine a list of attachments.
channelstringChannel to send the message to. If absent, the message goes to the channel selected for the O(token) specified during the creation of webhook.
colorstringnormalAllow text to use default colors - use the default of V(normal) to not send a custom color bar at the start of the message.
domainstringyesThe domain for your environment without protocol. (For example V(example.com) or V(chat.example.com)).
icon_emojistringEmoji 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_urlstringhttps://docs.ansible.com/favicon/favicon.icoURL for the message sender’s icon.
is_pre740boolfalseIf 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_namesint1Automatically create links for channels and usernames in O(msg).
msgstringMessage to be sent.
protocolstringhttpsSpecify the protocol used to send notification messages before the webhook URL (that is, V(http) or V(https)).
tokenstringyesRocket Chat Incoming Webhook integration token. This provides authentication to Rocket Chat’s Incoming webhook for posting messages.
usernamestringAnsibleThis is the sender of the message.
validate_certsbooltrueIf 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
Search
    ↑ ↓ move↵ openesc close