community.general.sensu_subscription 模块 – 管理 Sensu 订阅

注意

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

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

要安装它,请使用:ansible-galaxy collection install community.general

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

概要

  • 管理机器应订阅的sensu 通道

参数

参数

注释

备份

布尔值

创建一个备份文件(如果为 yes),包括时间戳信息,以便您

如果您以某种方式错误地覆盖了它,可以恢复原始文件。

选项

  • false ← (默认)

  • true

名称

字符串 / 必填

通道的名称

路径

字符串

订阅 json 文件的路径

默认值: "/etc/sensu/conf.d/subscriptions.json"

状态

字符串

机器应订阅还是取消订阅该通道

选项

  • "present" ← (默认)

  • "absent"

属性

属性

支持

描述

check_mode

支持: 完整

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

diff_mode

支持:

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

示例

# Subscribe to the nginx channel
- name: Subscribe to nginx checks
  community.general.sensu_subscription: name=nginx

# Unsubscribe from the common checks channel
- name: Unsubscribe from common checks
  community.general.sensu_subscription: name=common state=absent

返回值

常用返回值在 此处 中记录,以下是此模块特有的字段

描述

原因

列表 / 元素=字符串

模块更改或未更改某些内容的原因

返回值: 成功

示例: ["通道订阅不存在,并且状态为 `present'"]

作者

  • Anders Ingemann (@andsens)