vmware.vmware_rest.vcenter_vm_hardware_boot_device module – Manage the boot device order of a virtual machine.

Note

This module is part of the vmware.vmware_rest collection (version 5.0.0).

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 vmware.vmware_rest.

To use it in a playbook, specify: vmware.vmware_rest.vcenter_vm_hardware_boot_device.

New in vmware.vmware_rest 5.0.0

Synopsis

  • Set the ordered list of devices that a virtual machine attempts to boot from.

  • The order of the entries determines the sequence in which the virtual machine tries each device during boot.

  • Each entry identifies a device class (such as CD-ROM or floppy) or a specific bootable device such as one or more virtual disks or an Ethernet adapter.

  • This module replaces the entire boot device order with the list provided in devices.

  • This module does not support idempotence. The module will always report a change.

Parameters

Parameter

Comments

devices

list / elements=dictionary

The ordered list of devices the virtual machine attempts to boot from.

The virtual machine tries each entry in the order it appears in this list.

Providing this list replaces the current boot device order in its entirety.

disks

list / elements=string

The ordered list of virtual disks to boot from for this entry.

Relevant only when devices[].type is DISK.

Each element must be the identifier (MOID) of a virtual disk, as returned by vmware.vmware_rest.vcenter_vm_hardware_disk_info.

nic

string

The virtual Ethernet adapter to boot from for this entry.

Relevant only when devices[].type is ETHERNET.

Must be the identifier (MOID) of a virtual Ethernet adapter, as returned by vmware.vmware_rest.vcenter_vm_hardware_ethernet_info.

type

string / required

The kind of device this boot entry represents.

CDROM boots from a virtual CD-ROM device.

DISK boots from one or more virtual disks listed in devices[].disks.

ETHERNET boots over the network using the Ethernet adapter given in devices[].nic.

FLOPPY boots from a virtual floppy drive.

Choices:

  • "CDROM"

  • "DISK"

  • "ETHERNET"

  • "FLOPPY"

session_timeout

float

Timeout in seconds for the whole operation including connection establishment, request sending, and response.

Default: 300.0

state

string

The desired state of the resource.

Use present to create or update the resource.

Choices:

  • "present" ← (default)

vcenter_hostname

string / required

The hostname or IP address of the vSphere vCenter.

If the value is not specified in the task, the value of environment variable VMWARE_HOST will be used instead.

vcenter_password

string / required

The vSphere vCenter password.

If the value is not specified in the task, the value of environment variable VMWARE_PASSWORD will be used instead.

vcenter_port

integer

The port number of the vSphere vCenter.

If the value is not specified in the task, the value of environment variable VMWARE_PORT will be used instead.

vcenter_rest_log_file

string

Optional path to a log file for HTTP REST interaction.

If the value is not specified in the task, the value of environment variable VMWARE_REST_LOG_FILE will be used instead.

vcenter_username

string / required

The vSphere vCenter username.

If the value is not specified in the task, the value of environment variable VMWARE_USER will be used instead.

vcenter_validate_certs

boolean

Allows connection when SSL certificates are not valid.

Set to false when certificates are not trusted.

If the value is not specified in the task, the value of environment variable VMWARE_VALIDATE_CERTS will be used instead.

Choices:

  • false

  • true ← (default)

vm

string / required

Identifier of the virtual machine whose boot device order should be managed.

Must be an identifier (MOID) for a Vm resource.

Notes

Note

  • Generated from vSphere API spec 9.1.0.

  • Compatible with vSphere API 7.0.3.

  • Compatible with vSphere API 8.0.2.

Examples

- name: Look up the virtual machine by name
  register: search_result
  vmware.vmware_rest.vcenter_vm_info:
    filter_names:
      - test_vm1

- name: Boot from the CD-ROM device only
  vmware.vmware_rest.vcenter_vm_hardware_boot_device:
    vm: '{{ search_result.value[0].vm }}'
    devices:
      - type: CDROM
    state: present

- name: Set a boot order that tries the CD-ROM, then a disk, then the network
  vmware.vmware_rest.vcenter_vm_hardware_boot_device:
    vm: '{{ search_result.value[0].vm }}'
    devices:
      - type: CDROM
      - type: DISK
        disks:
          - '16000'
      - type: ETHERNET
        nic: '4000'
    state: present

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

id

string

MOID of the virtual machine whose boot device order was managed.

Returned: When state is present, or when a resource is deleted, or when state is set to a supported action.

Sample: "vm-1001"

value

any

The raw API response body from the vCenter operation.

The boot device update endpoint returns no content on success, so this value is typically empty.

Returned: On success.

Sample: {}

Authors

  • Ansible Eco Content Team (@eco-ansible-content)