community.general.statusio_maintenance 模块 – 为您的 status.io 仪表板创建维护窗口

注意

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

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

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

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

概要

  • 为 status.io 创建维护窗口

  • 删除 status.io 的维护窗口

参数

参数

注释

all_infrastructure_affected

布尔值

是否影响所有组件和容器

选择

  • false ← (默认)

  • true

api_id

字符串 / 必需

您的 status.io 的唯一 API ID

api_key

字符串 / 必需

您的 status.io 的唯一 API 密钥

automation

布尔值

自动启动和结束维护窗口

选择

  • false ← (默认)

  • true

components

别名:component

列表 / 元素=字符串

您的组件的给定名称(服务器名称)

containers

别名:container

列表 / 元素=字符串

您的容器的给定名称(数据中心)

desc

字符串

描述维护窗口的消息

默认值: "Created by Ansible"

maintenance_id

字符串

删除维护窗口时的维护 ID 号

maintenance_notify_1_hr

布尔值

在维护开始时间前 1 小时通知订阅者

选择

  • false ← (默认)

  • true

maintenance_notify_24_hr

布尔值

在维护开始时间前 24 小时通知订阅者

选择

  • false ← (默认)

  • true

maintenance_notify_72_hr

布尔值

在维护开始时间前 72 小时通知订阅者

选择

  • false ← (默认)

  • true

maintenance_notify_now

布尔值

立即通知订阅者

选择

  • false ← (默认)

  • true

minutes

整数

维护将运行的 UTC 时间长度(从 playbook 运行时开始)

默认值: 10

start_date

字符串

维护预计开始的日期(月/日/年)(UTC)

结束日期从 start_date + 分钟数计算得出

start_time

字符串

维护预计开始的时间(小时:分钟)(UTC)

结束时间从 start_time + 分钟数计算得出

state

字符串

软件包的期望状态。

选择

  • "present" ← (默认)

  • "absent"

statuspage

字符串 / 必需

您的 status.io 的唯一 StatusPage ID

title

字符串

维护窗口的描述性标题

默认值: "A new maintenance window"

url

字符串

Status.io API URL。可以使用私有 apiary 代替。

默认值: "https://api.status.io"

属性

属性

支持

描述

check_mode

支持: 完整

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

diff_mode

支持:

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

备注

注意

  • 您可以使用 apiary API url (http://docs.statusio.apiary.io/) 来捕获 API 流量

  • 使用 start_date 和 start_time 以及分钟数来设置未来的维护窗口

示例

- name: Create a maintenance window for 10 minutes on server1, with automation to stop the maintenance
  community.general.statusio_maintenance:
    title: Router Upgrade from ansible
    desc: Performing a Router Upgrade
    components: server1.example.com
    api_id: api_id
    api_key: api_key
    statuspage: statuspage_id
    maintenance_notify_1_hr: true
    automation: true

- name: Create a maintenance window for 60 minutes on server1 and server2
  community.general.statusio_maintenance:
    title: Routine maintenance
    desc: Some security updates
    components:
      - server1.example.com
      - server2.example.com
    minutes: 60
    api_id: api_id
    api_key: api_key
    statuspage: statuspage_id
    maintenance_notify_1_hr: true
    automation: true
  delegate_to: localhost

- name: Create a future maintenance window for 24 hours to all hosts inside the Primary Data Center
  community.general.statusio_maintenance:
    title: Data center downtime
    desc: Performing a Upgrade to our data center
    components: Primary Data Center
    api_id: api_id
    api_key: api_key
    statuspage: statuspage_id
    start_date: 01/01/2016
    start_time: 12:00
    minutes: 1440

- name: Delete a maintenance window
  community.general.statusio_maintenance:
    title: Remove a maintenance window
    maintenance_id: 561f90faf74bc94a4700087b
    statuspage: statuspage_id
    api_id: api_id
    api_key: api_key
    state: absent

作者

  • Benjamin Copeland (@bhcopeland)