telekom_mms.icinga_director.icinga_notification 模块 – 在 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。
telekom_mms.icinga_director 1.0.0 中的新增功能
概要
- 通过 director API 添加或删除 Icinga2 的通知。 
参数
| 参数 | 注释 | 
|---|---|
| 不要覆盖整个对象,而是追加已定义的属性。 注意 - 无法追加到现有变量、导入或任何其他列表/字典。您必须覆盖完整的列表/字典。 注意 - 默认设置的变量也将应用,即使未设置。 选项 
 | |
| 此通知应影响主机还是服务。 如果 state 为  选项 
 | |
| 通知生效的过滤器。 | |
| 用于 SSL 客户端身份验证的 PEM 格式证书链文件。 此文件也可以包含密钥,如果包含密钥,则不需要  | |
| 包含用于 SSL 客户端身份验证的私钥的 PEM 格式文件。 如果  | |
| 禁用的对象将不会部署。 选项 
 | |
| 如果  选项 
 | |
| 用于标识的标头,通常出现在 Web 服务器日志中。 默认值:  | |
| 可导入的模板,您可以添加任意数量的模板。当 state 为  请注意,从多个模板导入属性时,顺序很重要 - 最后一个优先。 如果 state 为  | |
| 通知间隔(以秒为单位)。此间隔用于活动通知。 默认为 30 分钟。如果设置为 0,则禁用重新通知。 | |
| 通知的名称。 | |
| 确定应何时触发此通知的时间段的名称。 | |
| 应用功能状态。 选项 
 | |
| 您想要为其获取通知的主机或服务状态。 | |
| 第一次通知延迟。 除非应发送第一次通知,否则延迟。 | |
| 最后一次通知。 应发送最后一次通知的时间。 | |
| 您想要为其获取通知的状态转换类型。 | |
| 采用 (http|https|ftp)://[user[:pass]]@host.domain[:port]/path 格式的 HTTP、HTTPS 或 FTP URL | |
| 用于 HTTP 基本身份验证的密码。 如果未指定  | |
| 用于 HTTP 基本身份验证的用户名。 此参数可与  | |
| 使用 GSSAPI 执行身份验证,这通常用于 Kerberos 或通过协商身份验证的 Kerberos。 需要安装 Python 库 gssapi。 GSSAPI 的凭据可以通过  即使已安装用于 NTLM 的 GSSAPI 机制,也不支持 NTLM 身份验证。 选项 
 | |
| 如果为  选项 
 | |
| 应由此通知通知的用户组。 默认:  | |
| 应由此通知通知的用户。 | |
| 如果为  这仅应在使用自签名证书的个人控制站点上使用。 选项 
 | |
| 通知的自定义属性。 默认:  | 
备注
注意
- 此模块支持检查模式。 
示例
- name: Create notification
  telekom_mms.icinga_director.icinga_notification:
    state: present
    url: "{{ icinga_url }}"
    url_username: "{{ icinga_user }}"
    url_password: "{{ icinga_pass }}"
    apply_to: host
    assign_filter: 'host.name="foohost"'
    imports:
      - foonotificationtemplate
    notification_interval: 0
    object_name: E-Mail_host
    states:
      - Up
      - Down
    types:
      - Problem
      - Recovery
    users:
      - rb
    user_groups:
      - OnCall
    disabled: false
    time_period: "24/7"
    times_begin: 20
    times_end: 120
- name: Create another notification
  telekom_mms.icinga_director.icinga_notification:
    state: present
    url: "{{ icinga_url }}"
    url_username: "{{ icinga_user }}"
    url_password: "{{ icinga_pass }}"
    apply_to: host
    assign_filter: 'host.name="foohost"'
    imports:
      - foonotificationtemplate
    notification_interval: 0
    object_name: E-Mail_host
    states:
      - Up
      - Down
    types:
      - Problem
      - Recovery
    users:
      - rb
    time_period: "24/7"
- name: Update notification
  telekom_mms.icinga_director.icinga_notification:
    state: present
    url: "{{ icinga_url }}"
    url_username: "{{ icinga_user }}"
    url_password: "{{ icinga_pass }}"
    object_name: E-Mail_host
    vars:
      foo: bar
    append: true
