community.general.pushbullet 模块 – 向 Pushbullet 发送通知

注意

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

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

要安装它,请使用:ansible-galaxy collection install community.general。您需要其他要求才能使用此模块,有关详细信息,请参阅 要求

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

概要

  • 此模块通过 Pushbullet 向频道或设备发送推送通知。

要求

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

  • pushbullet.py

参数

参数

注释

api_key

字符串 / 必需

Pushbullet API 令牌

body

字符串

通知正文,例如您正在警报的故障详细信息。

channel

字符串

您希望广播推送通知的频道标签,如 Pushbullet 页面上的“我的频道”>“编辑您的频道”所示。

device

字符串

您希望发送推送通知的设备名称,如 Pushbullet 主页所示。

push_type

字符串

您希望推送的内容。

选项

  • "note" ← (默认)

  • "link"

title

字符串 / 必需

通知标题。

url

字符串

URL 字段,在 push_type=link 时使用。

属性

属性

支持

描述

check_mode

支持:完全支持

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

diff_mode

支持:不支持

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

备注

注意

示例

- name: Sends a push notification to a device
  community.general.pushbullet:
    api_key: "ABC123abc123ABC123abc123ABC123ab"
    device: "Chrome"
    title: "You may see this on Google Chrome"

- name: Sends a link to a device
  community.general.pushbullet:
    api_key: ABC123abc123ABC123abc123ABC123ab
    device: Chrome
    push_type: link
    title: Ansible Documentation
    body: https://docs.ansible.org.cn/

- name: Sends a push notification to a channel
  community.general.pushbullet:
    api_key: ABC123abc123ABC123abc123ABC123ab
    channel: my-awesome-channel
    title: Broadcasting a message to the #my-awesome-channel folks

- name: Sends a push notification with title and body to a channel
  community.general.pushbullet:
    api_key: ABC123abc123ABC123abc123ABC123ab
    channel: my-awesome-channel
    title: ALERT! Signup service is down
    body: Error rate on signup service is over 90% for more than 2 minutes

作者

  • Willy Barro (@willybarro)