scale_computing.hypercore.virtual_disk_attach module – Clones an uploaded virtual disk and attaches it to a virtual machine.

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

New in scale_computing.hypercore 1.2.0

Synopsis

  • Clones an uploaded virtual disk and attaches it to a virtual machine.

  • If selected slot is not empty, selected virtual disk will not be attached.

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.

disk

dictionary

The disk that will be created when selected virtual disk is attached to selected virtual machine.

cache_mode

string

The cache mode the virtual machine will use.

Choices:

  • "none"

  • "writeback"

  • "writethrough"

disable_snapshotting

boolean

Disables the ability to snapshot the drive.

Choices:

  • false

  • true

disk_slot

integer / required

Virtual slot the drive will occupy.

read_only

boolean

Mount the new block device as read-only.

Choices:

  • false ← (default)

  • true

regenerate_disk_id

boolean

Regenerate the disk ID, e.g. GPT UUID or MBR signature.

Choices:

  • false

  • true ← (default)

size

integer

Logical size of the block device in bytes.

Should be greater or equal than the size of virtual disk. If smaller then capacity of the new block device/disk will automatically be set to the size of source virtual disk.

If not set, defaults to size of source virtual disk.

tiering_priority_factor

integer

SSD tiering priority factor for block placement.

Check the tiering documentation for best practices when modifying this.

Not relevant for cluster that only has a single tier - ie. only spinning disk or all flash.

Choices:

  • 0

  • 1

  • 2

  • 3

  • 4 ← (default)

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10

  • 11

type

string / required

The bus type the block device will use.

If type=ide_cdrom, iso_name is also required. Se documentation of iso_name for more details.

Choices:

  • "virtio_disk"

  • "ide_disk"

  • "scsi_disk"

name

string / required

Name of the virtual disk that we want to attach.

Used as a unique identifier of an uploaded virtual disk.

vm_name

string / required

Virtual machine name.

Used to identify selected virtual machine by name.

See Also

See also

scale_computing.hypercore.virtual_disk

Handles virtual disks on Hypercore cluster.

scale_computing.hypercore.virtual_disk_info

List virtual disks on HyperCore API.

scale_computing.hypercore.vm_disk

Manage VM’s disks.

Examples

- name: Clone an uploaded virtual disk and attach it to a virtual machine.
  scale_computing.hypercore.virtual_disk_attach:
    name: foobar.qcow2
    vm_name: my_virtual_machine
    disk:
      type: virtio_disk
      disk_slot: 0
      size: "{{ '11.1 GB' | human_to_bytes }}"
      cache_mode: writethrough
      disable_snapshotting: true
      tiering_priority_factor: 8
      read_only: true
      regenerate_disk_id: false
  register: disk

Return Values

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

Key

Description

record

dictionary

Created and attached disk or existing disk in disk_slot in case when the slot is already occupied.

Returned: success

cache_mode

string

The cache mode the VirDomainBlockDevice will use

Returned: success

Sample: "none"

disable_snapshotting

boolean

Disables the ability to snapshot the drive

Returned: success

Sample: false

disk_slot

integer

Virtual slot the drive will occupy

Returned: success

Sample: 0

iso_name

string

Name of the virtual storage device

Returned: success

Sample: "cloud-init-08425e56.iso"

mount_points

list / elements=string

Mount points of the drive in the guest OS, populated by the guest-agent

Returned: success

Sample: []

read_only

boolean

True if the device is read-only

Returned: success

Sample: false

size

integer

Logical size of the device in bytes, and can be increased on update or clone

Returned: success

Sample: 81001000100

tiering_priority_factor

integer

SSD tiering priority factor for block placement

Returned: success

Sample: 8

type

string

The bus type the VirDomainBlockDevice will use

Returned: success

Sample: "ide_cdrom"

uuid

string

Unique Identifier

Returned: success

Sample: "056ea04b-069c-4a22-84d5-5489b100029f"

vm_uuid

string

Identifier of the VirDomain this device is attached to

Returned: success

Sample: "1596dab1-6f90-494c-9607-b14221830433"

Authors

  • Polona Mihalič (@PolonaM)