telekom_mms.icinga_director.icinga_timeperiod_template 模块 – 在 Icinga2 中管理时间段模板

注意

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

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

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

要在 playbook 中使用它,请指定:telekom_mms.icinga_director.icinga_timeperiod_template

telekom_mms.icinga_director 1.17.0 中的新功能

概要

  • 通过 Director API 向 Icinga2 添加或删除时间段模板。

参数

参数

注释

追加

布尔值

在 telekom_mms.icinga_director 1.25.0 中添加

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

注意 - 无法追加到现有的 vars、imports 或任何其他列表/字典。您必须覆盖完整的列表/字典。

注意 - 默认设置的变量也将被应用,即使未设置。

选项

  • false

  • true

client_cert

路径

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

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

client_key

路径

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

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

禁用

布尔值

禁用的对象将不会被部署。

选项

  • false ← (默认)

  • true

display_name

字符串

此时间段模板的替代名称。

排除

别名: exclude_period

列表 / 元素=字符串

从此时间段中排除其他时间段。

默认: []

强制

布尔值

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

选项

  • false ← (默认)

  • true

force_basic_auth

布尔值

使用 url_usernameurl_password 指定的凭据应在 HTTP 标头中传递。

选项

  • false ← (默认)

  • true

http_agent

字符串

要标识为的标头,通常出现在 Web 服务器日志中。

默认: "ansible-httpget"

导入

列表 / 元素=字符串

可导入的模板,添加任意数量。

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

默认: []

包含

别名: include_period

列表 / 元素=字符串

将其他时间段包含在此时间段中。

默认: []

object_name

别名: name

字符串 / 必需

时间段的名称。

prefer_includes

布尔值

是否首选时间段的包含或排除。默认为 true。

选项

  • false

  • true ← (默认)

范围

字典

日期和时间段的字典。

状态

字符串

应用功能状态。

选项

  • "present" ← (默认)

  • "absent"

update_method

字符串

定义更新方法。

默认: "LegacyTimePeriod"

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 ← (默认)

validate_certs

布尔值

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

这应该仅在个人控制的使用自签名证书的站点上使用。

选项

  • false

  • true ← (默认)

zone

字符串

设置区域。

注意

注意

  • 此模块支持检查模式。

示例

- name: Create timeperiod template
  telekom_mms.icinga_director.icinga_timeperiod_template:
    state: present
    url: "{{ icinga_url }}"
    url_username: "{{ icinga_user }}"
    url_password: "{{ icinga_pass }}"
    object_name: "timeperiod_template"
    imports: []
    disabled: false
    prefer_includes: false
    ranges:
      monday: "00:00-23:59"
      tuesday: "00:00-23:59"
      wednesday: "00:00-23:59"
      thursday: "00:00-23:59"
      friday: "00:00-23:59"
      saturday: "00:00-23:59"
      sunday: "00:00-23:59"
    update_method: "LegacyTimePeriod"

- name: Update timeperiod template
  telekom_mms.icinga_director.icinga_timeperiod_template:
    state: present
    url: "{{ icinga_url }}"
    url_username: "{{ icinga_user }}"
    url_password: "{{ icinga_pass }}"
    object_name: "timeperiod_template"
    display_name: "timeperiod template"
    append: true

作者

  • Sebastian Gumprich (@rndmh3ro)