CUBE Server

cube_server

Create, update, destroy, update, resume, suspend, and reboot a Ionos CUBE virtual machine. When the virtual machine is created it can optionally wait for it to be 'running' before returning.

Example Syntax


name: Provision a server
ionoscloudsdk.ionoscloud.cube_server:
  datacenter: 'AnsibleAutoTestCompute'
  name: 'AnsibleAutoTestCompute 01'
  disk_type: DAS
  image: 'centos:7'
  image_password: '{{ lookup('ansible.builtin.password', '/dev/null chars=ascii_letters,digits') }}'
  location: de/txl
  count: 1
  assign_public_ip: true
  remove_boot_volume: true
  template_uuid: 15c6dd2f-02d2-4987-b439-9a58dd59ecc3
  availability_zone: AUTO
  wait: true
  wait_timeout: '500'
  state: present
register: server_cube


name: Update server
ionoscloudsdk.ionoscloud.cube_server:
  datacenter: 'AnsibleAutoTestCompute'
  name: 'AnsibleAutoTestCompute - UPDATED'
  instance_ids:
  - 'AnsibleAutoTestCompute 01'
  wait: true
  wait_timeout: '500'
  state: update


name: Remove server
ionoscloudsdk.ionoscloud.cube_server:
  datacenter: 'AnsibleAutoTestCompute'
  instance_ids:
  - 'AnsibleAutoTestCompute - UPDATED'
  remove_boot_volume: true
  wait_timeout: '500'
  state: absent


name: Resume server
ionoscloudsdk.ionoscloud.cube_server:
  datacenter: 'AnsibleAutoTestCompute'
  instance_ids:
  - 'AnsibleAutoTestCompute - UPDATED'
  wait_timeout: '500'
  state: resume


name: Suspend server
ionoscloudsdk.ionoscloud.cube_server:
  datacenter: 'AnsibleAutoTestCompute'
  instance_ids:
  - 'AnsibleAutoTestCompute - UPDATED'
  wait_timeout: '500'
  state: suspend

Returned object

{
    "changed": true,
    "failed": false,
    "machines": [
        {
            "entities": {
                "cdroms": {
                    "links": null,
                    "href": "https://api.ionos.com/cloudapi/v6/datacenters/fb6c7a8d-ab0a-434d-9507-7bb83835751a/servers/595d4dcb-8872-4b70-b757-071106809c11/cdroms",
                    "id": "595d4dcb-8872-4b70-b757-071106809c11/cdroms",
                    "items": [],
                    "limit": null,
                    "offset": null,
                    "type": "collection"
                },
                "nics": {
                    "links": null,
                    "href": "https://api.ionos.com/cloudapi/v6/datacenters/fb6c7a8d-ab0a-434d-9507-7bb83835751a/servers/595d4dcb-8872-4b70-b757-071106809c11/nics",
                    "id": "595d4dcb-8872-4b70-b757-071106809c11/nics",
                    "items": [
                        {
                            "entities": {
                                "firewallrules": {
                                    "links": null,
                                    "href": "https://api.ionos.com/cloudapi/v6/datacenters/fb6c7a8d-ab0a-434d-9507-7bb83835751a/servers/595d4dcb-8872-4b70-b757-071106809c11/nics/f3d10c9a-f27f-4c0e-911e-57116bfd6b5f/firewallrules",
                                    "id": "f3d10c9a-f27f-4c0e-911e-57116bfd6b5f/firewallrules",
                                    "items": null,
                                    "limit": null,
                                    "offset": null,
                                    "type": "collection"
                                },
                                "flowlogs": {
                                    "links": null,
                                    "href": "https://api.ionos.com/cloudapi/v6/datacenters/fb6c7a8d-ab0a-434d-9507-7bb83835751a/servers/595d4dcb-8872-4b70-b757-071106809c11/nics/f3d10c9a-f27f-4c0e-911e-57116bfd6b5f/flowlogs",
                                    "id": "f3d10c9a-f27f-4c0e-911e-57116bfd6b5f/flowlogs",
                                    "items": null,
                                    "limit": null,
                                    "offset": null,
                                    "type": "collection"
                                }
                            },
                            "href": "https://api.ionos.com/cloudapi/v6/datacenters/fb6c7a8d-ab0a-434d-9507-7bb83835751a/servers/595d4dcb-8872-4b70-b757-071106809c11/nics/f3d10c9a-f27f-4c0e-911e-57116bfd6b5f",
                            "id": "f3d10c9a-f27f-4c0e-911e-57116bfd6b5f",
                            "metadata": {
                                "created_by": "<USER_EMAIL>",
                                "created_by_user_id": "<USER_ID>",
                                "created_date": "2023-06-06T13:38:37+00:00",
                                "etag": "b5741a67e66f02d91468c1f1420c1fcf",
                                "last_modified_by": "<USER_EMAIL>",
                                "last_modified_by_user_id": "<USER_ID>",
                                "last_modified_date": "2023-06-06T13:38:37+00:00",
                                "state": "AVAILABLE"
                            },
                            "properties": {
                                "device_number": null,
                                "dhcp": true,
                                "firewall_active": false,
                                "firewall_type": "INGRESS",
                                "ips": [
                                    "<IP>"
                                ],
                                "lan": 1,
                                "mac": "02:01:ed:b1:3d:98",
                                "name": "90aaee2d0c",
                                "pci_slot": 6
                            },
                            "type": "nic"
                        }
                    ],
                    "limit": null,
                    "offset": null,
                    "type": "collection"
                },
                "volumes": {
                    "links": null,
                    "href": "https://api.ionos.com/cloudapi/v6/datacenters/fb6c7a8d-ab0a-434d-9507-7bb83835751a/servers/595d4dcb-8872-4b70-b757-071106809c11/volumes",
                    "id": "595d4dcb-8872-4b70-b757-071106809c11/volumes",
                    "items": [
                        {
                            "href": "https://api.ionos.com/cloudapi/v6/datacenters/fb6c7a8d-ab0a-434d-9507-7bb83835751a/volumes/52f55625-5fa3-4d9c-b244-6db1609c5918",
                            "id": "52f55625-5fa3-4d9c-b244-6db1609c5918",
                            "metadata": {
                                "created_by": "<USER_EMAIL>",
                                "created_by_user_id": "<USER_ID>",
                                "created_date": "2023-06-06T13:38:37+00:00",
                                "etag": "b5741a67e66f02d91468c1f1420c1fcf",
                                "last_modified_by": "<USER_EMAIL>",
                                "last_modified_by_user_id": "<USER_ID>",
                                "last_modified_date": "2023-06-06T13:38:37+00:00",
                                "state": "AVAILABLE"
                            },
                            "properties": {
                                "availability_zone": "AUTO",
                                "backupunit_id": null,
                                "boot_order": "AUTO",
                                "boot_server": "595d4dcb-8872-4b70-b757-071106809c11",
                                "bus": "VIRTIO",
                                "cpu_hot_plug": true,
                                "device_number": 1,
                                "disc_virtio_hot_plug": true,
                                "disc_virtio_hot_unplug": true,
                                "image": "48150141-a6b9-11ed-9e9f-e60bb43016ef",
                                "image_alias": null,
                                "image_password": null,
                                "licence_type": "LINUX",
                                "name": "ada2931874",
                                "nic_hot_plug": true,
                                "nic_hot_unplug": true,
                                "pci_slot": 5,
                                "ram_hot_plug": true,
                                "size": 30.0,
                                "ssh_keys": null,
                                "type": "DAS",
                                "user_data": null
                            },
                            "type": "volume"
                        }
                    ],
                    "limit": null,
                    "offset": null,
                    "type": "collection"
                }
            },
            "href": "https://api.ionos.com/cloudapi/v6/datacenters/fb6c7a8d-ab0a-434d-9507-7bb83835751a/servers/595d4dcb-8872-4b70-b757-071106809c11",
            "id": "595d4dcb-8872-4b70-b757-071106809c11",
            "metadata": {
                "created_by": "<USER_EMAIL>",
                "created_by_user_id": "<USER_ID>",
                "created_date": "2023-06-06T13:38:37+00:00",
                "etag": "b5741a67e66f02d91468c1f1420c1fcf",
                "last_modified_by": "<USER_EMAIL>",
                "last_modified_by_user_id": "<USER_ID>",
                "last_modified_date": "2023-06-06T13:38:37+00:00",
                "state": "AVAILABLE"
            },
            "properties": {
                "availability_zone": "AUTO",
                "boot_cdrom": null,
                "boot_volume": {
                    "href": "https://api.ionos.com/cloudapi/v6/datacenters/fb6c7a8d-ab0a-434d-9507-7bb83835751a/volumes/52f55625-5fa3-4d9c-b244-6db1609c5918",
                    "id": "52f55625-5fa3-4d9c-b244-6db1609c5918",
                    "type": "volume"
                },
                "cores": 1,
                "cpu_family": "AMD_EPYC",
                "name": "AnsibleAutoTestCompute 01",
                "ram": 1024,
                "template_uuid": "15c6dd2f-02d2-4987-b439-9a58dd59ecc3",
                "type": "CUBE",
                "vm_state": "RUNNING"
            },
            "type": "server"
        }
    ],
    "action": "create"
}

For more examples please check out the tests here.

NOTE: If you are using a versions 7.0.0 and up: modules can replace resources if certain set parameters differ from the results found in the API!

Parameters that can trigger a resource replacement:

  • template_uuid

  • availability_zone

state: resume

  
name: Resume server
ionoscloudsdk.ionoscloud.cube_server:
  datacenter: 'AnsibleAutoTestCompute'
  instance_ids:
  - 'AnsibleAutoTestCompute - UPDATED'
  wait_timeout: '500'
  state: resume

Available parameters for state resume:

Name
Required
Description

datacenter str

True

The datacenter to provision this virtual machine.

instance_ids list

False

list of instance ids. Should only contain one ID if renaming in update state Default:

api_url str

False

The Ionos API base URL.

certificate_fingerprint str

False

The Ionos API certificate fingerprint.

username str

False

The Ionos username. Overrides the IONOS_USERNAME environment variable.

password str

False

The Ionos password. Overrides the IONOS_PASSWORD environment variable.

token str

False

The Ionos token. Overrides the IONOS_TOKEN environment variable.

wait bool

False

Wait for the resource to be created before returning. Default: True Options: [True, False]

wait_timeout int

False

How long before wait gives up, in seconds. Default: 600

state str

False

Indicate desired state of the resource. Default: present Options: ['resume', 'suspend', 'absent', 'present', 'update']

state: suspend

  
name: Suspend server
ionoscloudsdk.ionoscloud.cube_server:
  datacenter: 'AnsibleAutoTestCompute'
  instance_ids:
  - 'AnsibleAutoTestCompute - UPDATED'
  wait_timeout: '500'
  state: suspend

Available parameters for state suspend:

Name
Required
Description

datacenter str

True

The datacenter to provision this virtual machine.

instance_ids list

False

list of instance ids. Should only contain one ID if renaming in update state Default:

api_url str

False

The Ionos API base URL.

certificate_fingerprint str

False

The Ionos API certificate fingerprint.

username str

False

The Ionos username. Overrides the IONOS_USERNAME environment variable.

password str

False

The Ionos password. Overrides the IONOS_PASSWORD environment variable.

token str

False

The Ionos token. Overrides the IONOS_TOKEN environment variable.

wait bool

False

Wait for the resource to be created before returning. Default: True Options: [True, False]

wait_timeout int

False

How long before wait gives up, in seconds. Default: 600

state str

False

Indicate desired state of the resource. Default: present Options: ['resume', 'suspend', 'absent', 'present', 'update']

state: absent

  
name: Remove server
ionoscloudsdk.ionoscloud.cube_server:
  datacenter: 'AnsibleAutoTestCompute'
  instance_ids:
  - 'AnsibleAutoTestCompute - UPDATED'
  remove_boot_volume: true
  wait_timeout: '500'
  state: absent

Available parameters for state absent:

Name
Required
Description

name str

False

The name of the resource.

datacenter str

True

The datacenter to provision this virtual machine.

instance_ids list

False

list of instance ids. Should only contain one ID if renaming in update state Default:

api_url str

False

The Ionos API base URL.

certificate_fingerprint str

False

The Ionos API certificate fingerprint.

username str

False

The Ionos username. Overrides the IONOS_USERNAME environment variable.

password str

False

The Ionos password. Overrides the IONOS_PASSWORD environment variable.

token str

False

The Ionos token. Overrides the IONOS_TOKEN environment variable.

wait bool

False

Wait for the resource to be created before returning. Default: True Options: [True, False]

wait_timeout int

False

How long before wait gives up, in seconds. Default: 600

state str

False

Indicate desired state of the resource. Default: present Options: ['resume', 'suspend', 'absent', 'present', 'update']

state: present

  
name: Provision a server
ionoscloudsdk.ionoscloud.cube_server:
  datacenter: 'AnsibleAutoTestCompute'
  name: 'AnsibleAutoTestCompute 01'
  disk_type: DAS
  image: 'centos:7'
  image_password: '{{ lookup('ansible.builtin.password', '/dev/null chars=ascii_letters,digits') }}'
  location: de/txl
  count: 1
  assign_public_ip: true
  remove_boot_volume: true
  template_uuid: 15c6dd2f-02d2-4987-b439-9a58dd59ecc3
  availability_zone: AUTO
  wait: true
  wait_timeout: '500'
  state: present
register: server_cube

Available parameters for state present:

Name
Required
Description

name str

True

The name of the resource.

assign_public_ip bool

False

This will assign the machine to the public LAN. If no LAN exists with public Internet access it is created. Default: False Options: [True, False]

image str

True

The image alias or ID for creating the virtual machine.

image_password str

False

Password set for the administrative user.

ssh_keys list

False

Public SSH keys allowing access to the virtual machine. Default:

user_data str

False

The cloud-init configuration for the volume as base64 encoded string.

datacenter str

True

The datacenter to provision this virtual machine.

availability_zone str

False

The availability zone in which the server should be provisioned. Options: ['AUTO', 'ZONE_1', 'ZONE_2']

bus str

False

The bus type for the volume. Default: VIRTIO Options: ['IDE', 'VIRTIO']

count int

False

The number of virtual machines to create. Default: 1

location str

False

The datacenter location. Use only if you want to create the Datacenter or else this value is ignored. Default: us/las Options: ['us/las', 'us/ewr', 'de/fra', 'de/fkb', 'de/txl', 'gb/lhr']

lan str

False

The ID or name of the LAN you wish to add the servers to (can be a string or a number).

nat bool

False

Boolean value indicating if the private IP address has outbound access to the public Internet. Default: False Options: [True, False]

remove_boot_volume bool

False

Remove the bootVolume of the virtual machine you're destroying. Default: True Options: [True, False]

disk_type str

False

The disk type for the volume. Default: DAS Options: ['HDD', 'SSD', 'SSD Standard', 'SSD Premium', 'DAS']

nic_ips list

False

The list of IPS for the NIC.

template_uuid str

False

The ID of the template for creating a CUBE server; the available templates for CUBE servers can be found on the templates resource.

boot_volume str

False

The volume used for boot.

boot_cdrom str

False

The CDROM used for boot.

api_url str

False

The Ionos API base URL.

certificate_fingerprint str

False

The Ionos API certificate fingerprint.

username str

False

The Ionos username. Overrides the IONOS_USERNAME environment variable.

password str

False

The Ionos password. Overrides the IONOS_PASSWORD environment variable.

token str

False

The Ionos token. Overrides the IONOS_TOKEN environment variable.

wait bool

False

Wait for the resource to be created before returning. Default: True Options: [True, False]

wait_timeout int

False

How long before wait gives up, in seconds. Default: 600

state str

False

Indicate desired state of the resource. Default: present Options: ['resume', 'suspend', 'absent', 'present', 'update']

state: update

  
name: Update server
ionoscloudsdk.ionoscloud.cube_server:
  datacenter: 'AnsibleAutoTestCompute'
  name: 'AnsibleAutoTestCompute - UPDATED'
  instance_ids:
  - 'AnsibleAutoTestCompute 01'
  wait: true
  wait_timeout: '500'
  state: update

Available parameters for state update:

Name
Required
Description

name str

False

The name of the resource.

datacenter str

True

The datacenter to provision this virtual machine.

instance_ids list

False

list of instance ids. Should only contain one ID if renaming in update state Default:

boot_volume str

False

The volume used for boot.

boot_cdrom str

False

The CDROM used for boot.

api_url str

False

The Ionos API base URL.

certificate_fingerprint str

False

The Ionos API certificate fingerprint.

username str

False

The Ionos username. Overrides the IONOS_USERNAME environment variable.

password str

False

The Ionos password. Overrides the IONOS_PASSWORD environment variable.

token str

False

The Ionos token. Overrides the IONOS_TOKEN environment variable.

wait bool

False

Wait for the resource to be created before returning. Default: True Options: [True, False]

wait_timeout int

False

How long before wait gives up, in seconds. Default: 600

state str

False

Indicate desired state of the resource. Default: present Options: ['resume', 'suspend', 'absent', 'present', 'update']

Last updated