community.general.jabber 模块 – 向 Jabber 用户或聊天室发送消息

注意

此模块是 community.general 集合(版本 10.1.0)的一部分。

如果您正在使用 ansible 包,则可能已经安装了此集合。它不包含在 ansible-core 中。要检查是否已安装,请运行 ansible-galaxy collection list

要安装它,请使用:ansible-galaxy collection install community.general。您需要进一步的要求才能使用此模块,请参阅 要求 了解详细信息。

要在 playbook 中使用它,请指定:community.general.jabber

概要

  • 向 Jabber 发送消息

要求

执行此模块的主机需要满足以下要求。

  • python xmpp (xmpppy)

参数

参数

注释

encoding

字符串

消息编码

host

字符串

要连接的主机,覆盖用户信息

msg

字符串 / 必需

消息正文。

password

字符串 / 必需

用户连接的密码

port

整数

要连接的端口,覆盖默认值

默认: 5222

to

字符串 / 必需

用户 ID 或房间名称,当使用房间时,请使用斜杠来指示您的昵称。

user

字符串 / 必需

要连接的用户

属性

属性

支持

描述

check_mode

支持: 完全

可以在 check_mode 中运行并返回更改状态预测,而无需修改目标。

diff_mode

支持:

当处于 diff 模式时,将返回有关已更改(或可能需要在 check_mode 中更改)的详细信息。

示例

- name: Send a message to a user
  community.general.jabber:
    user: [email protected]
    password: secret
    to: [email protected]
    msg: Ansible task finished

- name: Send a message to a room
  community.general.jabber:
    user: [email protected]
    password: secret
    to: [email protected]/ansiblebot
    msg: Ansible task finished

- name: Send a message, specifying the host and port
  community.general.jabber:
    user: [email protected]
    host: talk.example.net
    port: 5223
    password: secret
    to: [email protected]
    msg: Ansible task finished

作者

  • Brian Coca (@bcoca)