derjd.icinga2downtime
icinga2downtime
这个角色通过 API 在 icinga2 中添加和移除停机时间。 有一个 Github Issue 提出将此功能作为模块的建议,但最后的更新是在2018年... 目前它会停机主机及其所有关联服务。 移除停机时间是通过匹配评论和主机对象来完成的。
需求
目前没有特别需求。
变量
有许多默认值。通常只使用 dt_icinga
、dt_user
和 dt_pass
就足够了。
变量 | 默认值 | 描述 |
---|---|---|
i2d_icinga | None | 连接的 Icinga2 主机 |
i2d_port | 5665 | 连接的 Icinga2 端口 |
i2d_user | icinga2 | 用于身份验证的用户名 |
i2d_pass | icinga2 | 用于身份验证的密码 |
i2d_host | "{{ hostvars[inventory_hostname].ansible_host | default(inventory_hostname) }}" |
i2d_msg | 'downtimed with ansible-role icinga2downtime' | 停机时显示的评论 |
i2d_author | "{{ lookup('env','USER') }}" | 停机时显示的作者名字 |
i2d_from | 'now' | 停机时间范围以 Unix 时间戳设置。将由 date 转换 |
i2d_until | '+2 hours' | 停机时间范围以 Unix 时间戳设置。将由 date 转换 |
i2d_add | no | 设置为 yes 时添加停机时间 |
i2d_remove | no | 设置为 yes 时移除停机时间 |
依赖
目前没有特别依赖。
示例
---
- hosts: all
gather_facts: 'no'
vars:
i2d_icinga: icinga2.example.com
i2d_user: derJD
i2d_pass: VeryVerySecret!1
tasks:
- include_role:
name: derJD.icinga2downtime
apply:
delegate_to: localhost
vars: { i2d_add: "yes" }
- [执行其他操作]
- include_role:
name: derJD.icinga2downtime
apply:
delegate_to: localhost
vars: { i2d_remove: "yes" }
许可证
BSD