scale_computing.hypercore.vm_snapshot module – Handles VM snapshots.

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.

New in scale_computing.hypercore 1.2.0

Synopsis

  • Use this module to perform snapshot creation or deletion.

  • No snapshot will be created if VM already has a snapshot with same label as passed to module. This allows rerunning the playbook in idempotent way. Ansible will create a given snapshot only first time. This is notable difference from web UI, where user can create multiple snapshots with same label.

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.

label

string

Snapshot label, used as identificator in combination with vm_name.

Must be unique for a specific VM.

replication

boolean

When false, will not replicate snapshot to a remote system if replication is configured.

Choices:

  • false

  • true ← (default)

retain_for

integer

How many days does hypercore retain snapshot.

Local and remote retention is set by this.

Number of days.

VM must be powered on during automatic deletion process.

state

string / required

State of the snapshot.

Choices:

  • "present"

  • "absent"

uuid

string

Snapshot uuid, used as identificator.

Can be used instead of label.

Must be unique.

vm_name

string / required

source VM name.

See Also

See also

scale_computing.hypercore.vm_snapshot_info

List VM snapshots on HyperCore API.

Examples

- name: Create snapshot with label "new" from VM "test-VM"
  scale_computing.hypercore.vm_snapshot:
    vm_name: test-VM
    label: new
    state: present
  register: vm_snapshot

- name: Create snapshot with label "new" from VM "test-VM" that will automatically delete after 30 days
  scale_computing.hypercore.vm_snapshot:
    vm_name: test-VM
    label: new
    retain_for: 30
    state: present
  register: vm_snapshot

- name: Delete snapshot with label "new" made from VM with name "test-VM"
  scale_computing.hypercore.vm_snapshot:
    vm_name: test-VM
    label: new
    state: absent
  register: vm_snapshot

Return Values

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

Key

Description

record

dictionary

Snapshot record.

Returned: success

automated_trigger_timestamp

integer

Unix timestamp used when determining which automated snapshots to retain.

Returned: success

Sample: 0

block_count_diff_from_serial_number

integer

Snapshot serial number of the previous snapshot.

Returned: success

Sample: 0

label

string

Snapshot label.

Returned: success

Sample: "test"

local_retain_until_timestamp

integer

Snapshot local retention timestamp.

Returned: success

Sample: 1682337511

remote_retain_until_timestamp

integer

Snapshot remote retention timestamp.

Returned: success

Sample: 1682337511

replication

boolean

Replicaiton.

Returned: success

Sample: true

snapshot_uuid

string

Snapshot unique identifier.

Returned: success

Sample: "e7dca7ca-aa75-4c9d-a59a-6a27ad823942"

timestamp

string

Timestamp of snapshot creation.

Returned: success

Sample: "1682337511"

type

string

Snapshot type.

Returned: success

Sample: "USER"

vm

dictionary

Virtual machine used in snapshot.

Returned: success

Sample: {"name": "test-VD-Domen", "snapshot_serial_number": 23, "uuid": "7c4f0fa5-868c-4d06-89d7-c5db7d142030"}

Authors

  • Domen Dobnikar (@domen_dobnikar)