community.vmware.vmware_host_auto_start module – Manage the auto power ON or OFF for vm on ESXi host
Note
This module is part of the community.vmware collection (version 4.8.1).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.vmware
.
To use it in a playbook, specify: community.vmware.vmware_host_auto_start
.
Synopsis
In this module, can set up automatic startup and shutdown of virtual machines according to host startup or shutdown.
Parameters
Parameter |
Comments |
---|---|
ESXi hostname where the VM to set auto power on or off exists. |
|
The hostname or IP address of the vSphere vCenter or ESXi server. If the value is not specified in the task, the value of environment variable |
|
VM name to set auto power on or off. This is not necessary if change only system default VM settings for autoStart config. |
|
The password of the vSphere vCenter or ESXi server. If the value is not specified in the task, the value of environment variable |
|
The port number of the vSphere vCenter or ESXi server. If the value is not specified in the task, the value of environment variable Default: |
|
Startup or shutdown settings of virtual machine. This setting will override the system defaults. Default: |
|
Whether to start the virtual machine when the host startup. Choices:
|
|
Auto start delay in seconds of virtual machine. Default: |
|
The autostart priority of virtual machine. Virtual machines with a lower number are powered on first. On host shutdown, the virtual machines are shut down in reverse order, meaning those with a higher number are powered off first. Default: |
|
Stop action executed on the virtual machine when the system stops of virtual machine. Choices:
|
|
Auto stop delay in seconds of virtual machine. Default: |
|
Continue power on processing when VMware Tools started. Choices:
|
|
Address of a proxy that will receive all HTTPS requests and relay them. The format is a hostname or a IP. If the value is not specified in the task, the value of environment variable |
|
Port of the HTTP proxy that will receive all HTTPS requests and relay them. If the value is not specified in the task, the value of environment variable |
|
System defaults for auto-start or auto-stop config for virtual machine. |
|
Enable automatically start or stop of virtual machines. Choices:
|
|
Default auto start delay in seconds. Default: |
|
Default stop action executed on the virtual machine when the system stops. Choices:
|
|
Default auto stop delay in seconds. Default: |
|
Continue power on processing when VMware Tools started. If this parameter is enabled to powers on the next virtual machine without waiting for the delay to pass. However, the virtual machine must have VMware Tools installed. Choices:
|
|
Whether to use the VMware instance UUID rather than the BIOS UUID. Choices:
|
|
The username of the vSphere vCenter or ESXi server. If the value is not specified in the task, the value of environment variable |
|
VM uuid to set auto power on or off, this is VMware’s unique identifier. This is required if This is not necessary if change only system default VM settings for autoStart config. |
|
Allows connection when SSL certificates are not valid. Set to If the value is not specified in the task, the value of environment variable Choices:
|
Notes
Note
All modules requires API write access and hence is not supported on a free ESXi license.
All variables and VMware object names are case sensitive.
Examples
---
- name: Update for system defaults config.
community.vmware.vmware_host_auto_start:
hostname: "{{ hostname }}"
username: "{{ username }}"
password: "{{ password }}"
esxi_hostname: "{{ esxi_hostname }}"
system_defaults:
enabled: true
start_delay: 100
stop_action: guestShutdown
- name: Update for powerInfo config of virtual machine.
community.vmware.vmware_host_auto_start:
hostname: "{{ hostname }}"
username: "{{ username }}"
password: "{{ password }}"
esxi_hostname: "{{ esxi_hostname }}"
name: "{{ vm_name }}"
power_info:
start_action: powerOn
start_delay: 10
start_order: 1
stop_action: powerOff
wait_for_heartbeat: true
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Parameter return when virtual machine power info config is changed. Returned: changed Sample: |
|
Parameter return when system defaults config is changed. Returned: changed Sample: |