scale_computing.hypercore.vm_params module – Manage VM’s parameters

Note

This module is part of the scale_computing.hypercore collection (version 1.6.0).

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 scale_computing.hypercore.

To use it in a playbook, specify: scale_computing.hypercore.vm_params.

New in scale_computing.hypercore 1.0.0

Synopsis

  • Use vm_params to update VM’s name, description, tags, memory, number of CPUs or change VM’s power state.

  • Can also be used to assign a snapshot schedule to the VM.

Parameters

Parameter

Comments

cluster_instance

dictionary

Scale Computing HyperCore instance information.

auth_method

string

Select login method. If not set, the value of the SC_AUTH_METHOD environment variable will be used.

Value local - username/password is verified by the HyperCore server (the local users).

Value oidc - username/password is verified by the configured OIDC provider.

Choices:

  • "local" ← (default)

  • "oidc"

host

string / required

The HyperCore instance URL.

If not set, the value of the SC_HOST environment variable will be used.

For example “https://10.1.2.3:443”.

password

string / required

Password used for authentication.

If not set, the value of the SC_PASSWORD environment variable will be used.

timeout

float

Timeout in seconds for the connection with the Scale Computing HyperCore API instance.

If not set, the value of the SC_TIMEOUT environment variable will be used.

username

string / required

Username used for authentication.

If not set, the value of the SC_USERNAME environment variable will be used.

description

string

VM’s description.

force_reboot

boolean

Can VM be forced to power off and on.

Only used when modifications to the VM require it to be powered off and VM does not respond to a shutdown request within shutdown_timeout limit.

Before this is utilized, a shutdown request is sent.

Choices:

  • false ← (default)

  • true

machine_type

string

Changes VM machine type.

Before this is utilized, a shutdown request is sent.

The UEFI machine types require NVRAM disk attached to VM. The vTPM machine types require vTPM disk attached to VM. If such disk is not present, module will reject machine type change and fail with error.

Choices:

  • "BIOS"

  • "UEFI"

  • "vTPM+UEFI"

  • "vTPM+UEFI-compatible"

memory

integer

Amount of memory reserved, in bytes.

May only be modified if VM is in SHUTOFF or CRASHED state.

operating_system

string

Operating system name.

Used to select drivers package

Choices:

  • "os_windows_server_2012"

  • "os_other"

power_state

string

Desired VM state.

States PAUSE and LIVEMIGRATE are not exposed in this module (this can be done with raw api module).

Note that - shutdown will trigger a graceful ACPI shutdown. - reboot will trigger a graceful ACPI reboot. - stop will trigger an abrupt shutdown (force power off). VM might loose data, and filesystem might be corrupted afterwards. - reset will trigger an abrupt reset (force power reset). VM might loose data, and filesystem might be corrupted afterwards.

Choices:

  • "start"

  • "shutdown"

  • "stop"

  • "reboot"

  • "reset"

shutdown_timeout

float

How long does ansible controller wait for VMs response to a shutdown request.

In seconds.

Default: 300.0

snapshot_schedule

string

The name of an existing snapshot_schedule to assign to VM.

VM can have 0 or 1 snapshot schedules assigned.

tags

list / elements=string

User-modifiable words for organizing a group of VMs. Multiple tags should be provided as list.

All existing tags will be overwritten, so group tag should always be included.

vcpu

integer

Number of allotted virtual CPUs.

May only be modified if VM is in SHUTOFF or CRASHED state.

vm_name

string / required

Virtual machine name.

Used to identify selected virtual machine by name.

vm_name_new

string

VM’s new name.

Notes

Note

  • check_mode is not supported.

Examples

- name: Set VM simple params
  scale_computing.hypercore.vm_params:
    vm_name: demo-vm
    vm_name_new: renamed-vm
    description: test vm params
    force_reboot: true
    shutdown_timeout: "{{ '5minutes' | community.general.to_time_unit('seconds') }}"
    tags:
      - Group-name
      - tag1
      - tag2
    memory: "{{ '512 MB' | human_to_bytes }}"
    vcpu: 2
    power_state: shutdown
    snapshot_schedule: demo-snap-schedule

- name: Delete description, tags and snapshot_schedule
  scale_computing.hypercore.vm_params:
    vm_name: demo-vm
    description: ""
    tags: [""]
    snapshot_schedule: ""

Return Values

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

Key

Description

vm_rebooted

boolean

Info if reboot of the VM was performed.

Returned: success

Sample: true

Authors

  • Polona Mihalič (@PolonaM)