telekom_mms.icinga_director.icinga_notification_template 模块 – 在 Icinga2 中管理通知模板

注意

此模块是 telekom_mms.icinga_director 集合 (版本 2.2.1) 的一部分。

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

要安装它,请使用: ansible-galaxy collection install telekom_mms.icinga_director

要在剧本中使用它,请指定: telekom_mms.icinga_director.icinga_notification_template

telekom_mms.icinga_director 1.9.0 中的新增功能

概要

  • 通过 director API 添加或删除 Icinga2 的通知模板。

参数

参数

注释

append

布尔值

telekom_mms.icinga_director 1.25.0 中新增

不要覆盖整个对象,而是附加定义的属性。

注意 - 无法追加到现有的变量、导入或任何其他列表/字典。您必须覆盖整个列表/字典。

注意 - 默认设置的变量也会应用,即使未设置也是如此。

选项

  • false

  • true

client_cert

路径

用于 SSL 客户端身份验证的 PEM 格式证书链文件。

此文件也可以包含密钥,如果包含密钥,则不需要 client_key

client_key

路径

包含用于 SSL 客户端身份验证的私钥的 PEM 格式文件。

如果 client_cert 包含证书和密钥,则不需要此选项。

command

别名:notification_command

字符串

telekom_mms.icinga_director 1.15.0 中新增

检查命令定义

force

布尔值

如果为 yes,则不获取缓存副本。

选项

  • false ← (默认)

  • true

force_basic_auth

布尔值

使用 url_usernameurl_password 指定的凭据应通过 HTTP 头传递。

选项

  • false ← (默认)

  • true

http_agent

字符串

用于识别的标头,通常显示在 Web 服务器日志中。

默认值: "ansible-httpget"

imports

列表 / 元素=字符串

可导入的模板,您可以添加任意数量的模板。当 state 为 present 时,这是必需的。

请注意,从多个模板导入属性时,顺序很重要 - 最后一个优先。

如果 *state* 为 present,则需要此参数。

notification_interval

字符串

通知间隔(以秒为单位)。此间隔用于活动通知。

默认为 30 分钟。如果设置为 0,则禁用重新通知。

object_name

别名:name

字符串 / 必需

通知模板的名称。

period

别名:time_period

字符串

telekom_mms.icinga_director 1.15.0 中新增

确定应何时触发此通知的时间段的名称。

state

字符串

应用特性状态。

选项

  • "present" ← (默认)

  • "absent"

states

列表 / 元素=字符串

您希望获取通知的主机或服务状态。

times_begin

整数

第一次通知延迟。

除非应发送第一次通知,否则延迟。

times_end

整数

最后一次通知。

应发送最后一次通知的时间。

types

列表 / 元素=字符串

您希望获取通知的状态转换类型。

url

字符串 / 必需

格式为 (http|https|ftp)://[user[:pass]]@host.domain[:port]/path 的 HTTP、HTTPS 或 FTP URL

url_password

字符串

用于 HTTP 基本身份验证的密码。

如果未指定 url_username 参数,则不会使用 url_password 参数。

url_username

字符串

用于 HTTP 基本身份验证的用户名。

此参数可与 url_password 一起使用,用于允许空密码的站点。

use_gssapi

布尔值

ansible-core 2.11 中新增

使用 GSSAPI 执行身份验证,通常用于 Kerberos 或通过 Negotiate 身份验证进行 Kerberos 身份验证。

需要安装 Python 库 gssapi

GSSAPI 的凭据可以通过 url_username/url_password 指定,也可以通过指定自定义 Kerberos 凭据缓存的 GSSAPI 环境变量 KRB5CCNAME 指定。

即使已安装用于 NTLM 的 GSSAPI 机制,也不支持 NTLM 身份验证。

选项

  • false ← (默认)

  • true

use_proxy

布尔值

如果为 no,即使目标主机上的环境变量中定义了代理,也不会使用代理。

选项

  • false

  • true ← (默认值)

user_groups

列表 / 元素=字符串

在 telekom_mms.icinga_director 1.16.0 版本中添加

应由此通知通知的用户组。

users

列表 / 元素=字符串

telekom_mms.icinga_director 1.15.0 中新增

应由此通知通知的用户。

validate_certs

布尔值

如果为 no,则不会验证 SSL 证书。

此选项仅应在使用自签名证书的个人控制站点上使用。

选项

  • false

  • true ← (默认值)

zone

字符串

设置区域。

备注

注意

  • 此模块支持检查模式。

示例

- name: Create notification template
  telekom_mms.icinga_director.icinga_notification_template:
    state: present
    url: "{{ icinga_url }}"
    url_username: "{{ icinga_user }}"
    url_password: "{{ icinga_pass }}"
    object_name: foonotificationtemplate
    states:
      - Up
      - Down
    types:
      - Problem
      - Recovery
    times_begin: 20
    times_end: 120
    time_period: "24/7"
    notification_command: "mail-host-notification"
    users:
      - "rb"
    user_groups:
      - "OnCall"
    zone: "foozone"

- name: Update notification template
  telekom_mms.icinga_director.icinga_notification_template:
    state: present
    url: "{{ icinga_url }}"
    url_username: "{{ icinga_user }}"
    url_password: "{{ icinga_pass }}"
    object_name: foonotificationtemplate
    notification_interval: '0'
    append: true

作者

  • Sebastian Gumprich (@rndmh3ro) / Sebastian Gruber (sgruber94)