vmware.vmware_rest.appliance_shutdown 模块 – 取消待处理的关机操作。

注意

此模块是 vmware.vmware_rest 集合(版本 4.3.0)的一部分。

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

要安装它,请使用:ansible-galaxy collection install vmware.vmware_rest。您需要其他要求才能使用此模块,有关详细信息,请参阅 要求

要在 Playbook 中使用它,请指定:vmware.vmware_rest.appliance_shutdown

vmware.vmware_rest 2.0.0 中的新增功能

概要

  • 取消待处理的关机操作。

要求

执行此模块的主机需要满足以下要求。

  • vSphere 7.0.3 或更高版本

  • python >= 3.6

  • aiohttp

参数

参数

注释

delay

整数

断电应开始的分钟数。如果指定为 0,则会立即开始断电。使用 *state=['poweroff', 'reboot']* 时是必需的

reason

字符串

执行断电的原因。使用 *state=['poweroff', 'reboot']* 时是必需的

session_timeout

浮点数

在 vmware.vmware_rest 2.1.0 中添加

客户端会话的超时设置。

整个操作(包括建立连接、发送请求和响应)的最大秒数。

默认值为 300 秒。

state

字符串 / 必需

选择

  • "cancel"

  • "poweroff"

  • "reboot"

vcenter_hostname

字符串 / 必需

vSphere vCenter 的主机名或 IP 地址

如果未在任务中指定值,则将使用环境变量 VMWARE_HOST 的值。

vcenter_password

字符串 / 必需

vSphere vCenter 密码

如果未在任务中指定值,则将使用环境变量 VMWARE_PASSWORD 的值。

vcenter_rest_log_file

字符串

您可以使用此可选参数来设置日志文件的位置。

此文件将用于记录 HTTP REST 交互。

该文件将存储在运行模块的主机上。

如果未在任务中指定值,则将使用

环境变量 VMWARE_REST_LOG_FILE 的值。

vcenter_username

字符串 / 必需

vSphere vCenter 用户名

如果未在任务中指定值,则将使用环境变量 VMWARE_USER 的值。

vcenter_validate_certs

布尔值

当 SSL 证书无效时允许连接。当证书不受信任时,设置为 false

如果未在任务中指定值,则将使用环境变量 VMWARE_VALIDATE_CERTS 的值。

选择

  • false

  • true ← (默认)

注释

注意

  • 在 vSphere 7.0.3 上测试

示例

- name: Shutdown the appliance
  vmware.vmware_rest.appliance_shutdown:
    state: poweroff
    reason: this is an example
    delay: 600
  register: result

- name: Abort the shutdown of the appliance
  vmware.vmware_rest.appliance_shutdown:
    state: cancel
  register: result

- name: Reboot the appliance
  vmware.vmware_rest.appliance_shutdown:
    state: reboot
    reason: this is an example
    delay: 600
  register: result

- name: Abort the reboot
  vmware.vmware_rest.appliance_shutdown:
    state: cancel
  register: result

返回值

通用返回值记录在 此处,以下是此模块独有的字段

描述

字典

中止重启

返回:成功时

示例: {}

作者

  • Ansible 云团队 (@ansible-collections)