scale_computing.hypercore.vm_node_affinity module – Update virtual machine’s node affinity

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

New in scale_computing.hypercore 1.0.0

Synopsis

  • Module updates selected virtual machine node affinity. preferred_node or backup_node can be configured for each VM. The term node later in this text means either preferred_node or backup_node.

  • The node can be selected by one or more parameters - node_uuid, backplane_ip, lan_ip and/or peer_id. If node is selected by multiple parameters, then all parameters must match, e.g. module internally performs logical AND when searching for matching node UUID.

  • If strict_affinity is set to true, VM will only run on preferred_node or backup_node.

  • If node is not set, the old value of the node.node_uuid will be kept.

  • If node.node_uuid is set to empty string, the existing value of the node.node_uuid will be deleted.

Parameters

Parameter

Comments

backup_node

dictionary

Backup node in the event that preferred_node is unavailable

Can be set by node_uuid, backplane_ip, lan_ip or peer_id

One of the options should be enough. In case that all are set, logical AND operation is used. Task will FAIL in case that node can not be uniquely identified.

backplane_ip

string

Backplane IP of the backup node

lan_ip

string

Lan IP of the backup node

node_uuid

string

Unique identifier of backup node

peer_id

integer

Peer ID of the backup node

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.

preferred_node

dictionary

Preferred node to run the VM

Can be set by node_uuid, backplane_ip, lan_ip or peer_id

One of the options should be enough. In case that all are set, logical AND operation is used. Task will FAIL in case that node can not be uniquely identified.

backplane_ip

string

Backplane IP of the preferred node

lan_ip

string

Lan IP of the preferred node

node_uuid

string

Unique identifier of preferred node

peer_id

integer

Peer ID of the preffered node

strict_affinity

boolean / required

Enable or disable strict enforcement of affinity strategy.

If preferred_node and backup_node are not set (in task or in VM) and strict_affinity is set to True, the task will FAIL.

Choices:

  • false

  • true

vm_name

string / required

Virtual machine name.

Used to identify selected virtual machine by name.

Notes

Note

  • check_mode is not supported.

See Also

See also

scale_computing.hypercore.node_info

Returns information about the nodes in a cluster.

Examples

- name: Set VM node affinity by node uuid
  scale_computing.hypercore.vm_node_affinity:
    vm_name: demo-vm
    strict_affinity: true
    preferred_node:
      node_uuid: "412a3e85-8c21-4138-a36e-789eae3548a3"
    backup_node:
      node_uuid: "3dd52913-4e60-46fa-8ac6-07ba0b2155d2"

- name: Set VM node affinity by backplane IP, lan IP, and peer ID
  scale_computing.hypercore.vm_node_affinity:
    vm_name: demo-vm
    strict_affinity: true
    preferred_node:
      backplane_ip: "10.0.0.1"
      lan_ip: "10.0.0.1"
      peer_id: 1
    backup_node:
      backplane_ip: "10.0.0.2"
      lan_ip: "10.0.0.2"
      peer_id: 2

- name: Set strict affinity to false and delete the nodes
  scale_computing.hypercore.vm_node_affinity:
    vm_name: demo-vm
    strict_affinity: false
    preferred_node:
      node_uuid: ""
    backup_node:
      node_uuid: ""

Return Values

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

Key

Description

msg

string

Info about node affinity update status.

Returned: always

Sample: "{'msg': 'Node affinity successfully updated.'}"

Authors

  • Polona Mihalič (@PolonaM)