scale_computing.hypercore.vm_snapshot_attach_disk module – Attach a disk from a snapshot to a VM on HyperCore API.

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_snapshot_attach_disk.

New in scale_computing.hypercore 1.2.0

Synopsis

  • Use this module to attach a disk from a snapshot to a desired VM on HyperCore API.

  • Specified disk from source snapshot will be cloned. Cloned disk is then attached to the destination 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.

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

shutdown_timeout

float

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

In seconds.

Default: 300.0

source_disk_slot

integer / required

Specify a disk slot from source snapshot to identify source disk.

source_disk_type

string / required

Specify a disk type from source snapshot.

source_snapshot_uuid

string / required

UUID of the snapshot we want to use on a VM.

vm_disk_slot

integer / required

Specify a disk slot from a vm to identify destination disk.

Note that this MUST be a next free slot or an already used slot for the given disk_type. Otherwise VM might not boot.

vm_disk_type

string / required

Type of disk on the VM that we want to attach a VM snapshot disk to.

vm_name

string / required

Name of the VM we want to attach a VM snapshot disk to.

Notes

Note

  • check_mode is not supported

  • The VM will be rebooted if it is running.

See Also

See also

scale_computing.hypercore.vm_snapshot_info

List VM snapshots on HyperCore API.

Examples

- name: Attach a disk from a VM Snapshot to a VM
  scale_computing.hypercore.vm_snapshot_attach_disk:
    vm_name: example-vm
    vm_disk_type: ide_disk
    vm_disk_slot: 42
    source_snapshot_uuid: 116d51cc-ec25-4628-a092-86de42699aac
    source_disk_type: virtio_disk
    source_disk_slot: 1

Return Values

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

Key

Description

record

dictionary

Newly attached disk from a VM snapshot to a VM.

Returned: success

disk_slot

integer

Disk slot.

Returned: success

Sample: 42

size

integer

Total capacity, in bytes.

Returned: success

Sample: 100000595968

type

string

Disk type.

Returned: success

Sample: "ide_disk"

uuid

string

Disk unique identifier.

Returned: success

Sample: "5b4b7324-eccf-43c9-925a-6417e02860ff"

vm_uuid

string

VM unique identifier.

Returned: success

Sample: "e18ec6af-9dd2-41dc-89af-8ce637171524"

vm_rebooted

boolean

Info if reboot of the VM was performed.

Returned: success

Sample: true

Authors

  • Ana Zobec (@anazobec)