community.general.rocketchat 模块 – 向 Rocket Chat 发送通知
注意
此模块是 community.general 集合 (版本 10.1.0) 的一部分。
如果您使用的是 ansible
包,则可能已经安装了此集合。它不包含在 ansible-core
中。要检查它是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用: ansible-galaxy collection install community.general
。
要在 playbook 中使用它,请指定: community.general.rocketchat
。
概要
rocketchat
模块通过 Incoming WebHook 集成向 Rocket Chat 发送通知。
参数
参数 |
注释 |
---|---|
定义附件列表。 |
|
发送消息的频道。如果缺失,则消息将发送到创建 webhook 时为 |
|
允许文本使用默认颜色 - 使用默认值“normal”不发送消息开头的自定义颜色条 选项
|
|
您环境的域名,不含协议。(例如 |
|
消息发送者图标的 URL。 默认: |
|
要发送的消息。 |
|
在 webhook URL 前指定用于发送通知消息的协议(即 选项
|
|
Rocket Chat Incoming Webhook 集成令牌。这为 Rocket Chat 的 Incoming webhook 提供发布消息的身份验证。 |
|
这是消息的发送者。 默认: |
|
如果为 选项
|
属性
属性 |
支持 |
描述 |
---|---|---|
支持: 不支持 |
可以在 |
|
支持: 不支持 |
在 diff 模式下,将返回关于已更改内容(或在 |
示例
- 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
返回值
常见的返回值已在 此处 记录,以下是此模块特有的字段
键 |
描述 |
---|---|
指示是否进行了任何更改的标志。 返回:成功 示例: |