stephrobert.scaleway.instance_server module – Manage a Scaleway Instance server

Note

This module is part of the stephrobert.scaleway collection (version 0.7.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 stephrobert.scaleway. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: stephrobert.scaleway.instance_server.

New in stephrobert.scaleway 0.1.0

Synopsis

  • Update the Instance information, such as name, boot mode, or tags.

  • The module reads the resource first and writes only the fields that differ, so a second run reports no change.

Requirements

The below requirements are needed on the host that executes this module.

  • scaleway >= 2.9.0

Parameters

Parameter

Comments

access_key

string

Scaleway API access key.

admin_password_encryption_ssh_key_id

string

UUID of the SSH RSA key that will be used to encrypt the initial admin password for OS requiring it. Mandatory for Windows OS. The public_key value of this key is used to encrypt the admin password. When set to an empty string, reset this value and admin_password_encrypted_value to an empty string so a new password may be generated.

To clear this field, write `admin_password_encryption_ssh_key_id: “”`; omit the option to leave the current value untouched.

Setting it to null is refused: this API reads null as “field not provided” and would change nothing.

api_allow_insecure

boolean

Allow the API endpoint to be reached without verifying its TLS certificate.

Falls back to the Scaleway configuration file, then to false.

Choices:

  • false

  • true

api_timeout

integer

Seconds allowed for a single API call, connection and read.

Without a limit a silent connection would hang the module forever: the Scaleway SDK issues its requests with no timeout at all.

This bounds a single call, not a whole wait. Modules that can wait for a state bound the overall wait separately.

Default: 60

api_url

string

URL of the Scaleway API endpoint.

Point it at a local emulator to exercise a playbook without credentials.

Falls back to the Scaleway configuration file, then to https://api.scaleway.com. It carries no module default on purpose: a default is never unset, so it would always override the profile.

boot_type

string

Instance boot type.

Choices:

  • "local"

  • "bootscript"

  • "rescue"

commercial_type

string

Set the commercial_type for this Instance. Warning: This field has some restrictions: - Cannot be changed if the Instance is not in `stopped` state. - Cannot be changed if the Instance is in a placement group. - Cannot be changed from/to a Windows offer to/from a Linux offer. - Local storage requirements of the target commercial_types must be fulfilled (i.e. if an Instance has 80GB of local storage, it can be changed into a GP1-XS, which has a maximum of 150GB, but it cannot be changed into a DEV1-S, which has only 20GB).

To clear this field, write `commercial_type: “”`; omit the option to leave the current value untouched.

Setting it to null is refused: this API reads null as “field not provided” and would change nothing.

config_file

path

Path to the Scaleway configuration file.

dynamic_ip_required

boolean

True if a dynamic IPv4 is required.

The contract marks this field clearable, but bool has no empty value, so the API cannot clear it. Setting it to null is refused: this API reads null as “field not provided” and would change nothing.

Choices:

  • false

  • true

enable_ipv6

boolean

True if IPv6 is enabled (deprecated and always `False` when `routed_ip_enabled` is `True`).

Deprecated by the Scaleway API contract.

The contract marks this field clearable, but bool has no empty value, so the API cannot clear it. Setting it to null is refused: this API reads null as “field not provided” and would change nothing.

Choices:

  • false

  • true

name

string

Name of the Instance.

To clear this field, write `name: “”`; omit the option to leave the current value untouched.

Setting it to null is refused: this API reads null as “field not provided” and would change nothing.

organization_id

string

Default Organization ID used when an operation does not name one.

placement_group

string

Placement group ID if Instance must be part of a placement group.

To clear this field, write `placement_group: “”`; omit the option to leave the current value untouched.

Setting it to null is refused: this API reads null as “field not provided” and would change nothing.

private_nics

list / elements=string

Instance private NICs.

To clear this field, write `private_nics: []`; omit the option to leave the current value untouched.

Setting it to null is refused: this API reads null as “field not provided” and would change nothing.

profile

string

Name of the profile to read in the Scaleway configuration file.

project_id

string

Default Project ID used when an operation does not name one.

protected

boolean

True to activate server protection option.

The contract marks this field clearable, but bool has no empty value, so the API cannot clear it. Setting it to null is refused: this API reads null as “field not provided” and would change nothing.

Choices:

  • false

  • true

public_ips

list / elements=string

A list of reserved IP IDs to attach to the Instance.

To clear this field, write `public_ips: []`; omit the option to leave the current value untouched.

Setting it to null is refused: this API reads null as “field not provided” and would change nothing.

routed_ip_enabled

boolean

True to configure the instance so it uses the new routed IP mode (once this is set to True you cannot set it back to False).

Deprecated by the Scaleway API contract.

The contract marks this field clearable, but bool has no empty value, so the API cannot clear it. Setting it to null is refused: this API reads null as “field not provided” and would change nothing.

Choices:

  • false

  • true

secret_key

string

Scaleway API secret key.

security_group

dictionary

Instance security group.

server_id

string / required

UUID of the Instance.

tags

list / elements=string

Tags of the Instance.

To clear this field, write `tags: []`; omit the option to leave the current value untouched.

Setting it to null is refused: this API reads null as “field not provided” and would change nothing.

user_agent

string

Value of the User-Agent header sent to the API.

volumes

dictionary

Instance volumes.

zone

string / required

The zone you want to target

Choices:

  • "fr-par-1"

  • "fr-par-2"

  • "fr-par-3"

  • "nl-ams-1"

  • "nl-ams-2"

  • "nl-ams-3"

  • "pl-waw-1"

  • "pl-waw-2"

  • "pl-waw-3"

  • "it-mil-1"

Attributes

Attribute

Support

Description

check_mode

Support: full

In check mode the module reads the resource and compares it, then reports what it would write without writing it.

diff_mode

Support: full

The module reports the fields that differ, read through the same projection the comparison uses.

Notes

Note

  • Every option can be set from its environment variable, respectively SCW_PROFILE, SCW_CONFIG_PATH, SCW_ACCESS_KEY, SCW_SECRET_KEY, SCW_API_URL, SCW_DEFAULT_ORGANIZATION_ID and SCW_DEFAULT_PROJECT_ID.

  • Module options take precedence over environment variables, which take precedence over the configuration file.

Examples

# The module reads the resource, compares, and writes only what
# differs: run it twice and the second run reports no change.
#
# Check mode compares without writing, and `--diff` shows what would
# change. A parameter you do not pass is a parameter the module does
# not touch.

- name: Update a Scaleway Instance server
  stephrobert.scaleway.instance_server:
    zone: fr-par-1
    server_id: 11111111-2222-3333-4444-555555555555
    name: my-server
  register: result
- name: Preview the change on a Scaleway Instance server without writing
  stephrobert.scaleway.instance_server:
    zone: fr-par-1
    server_id: 11111111-2222-3333-4444-555555555555
    name: my-server
  register: result
  check_mode: true
  diff: true

Return Values

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

Key

Description

server

dictionary

Get the details of a specified Instance.

Returned: success

admin_password_encrypted_value

string

A base64 encoded string containing the admin password encrypted with the public key pointed to by admin_password_encryption_ssh_key_id. This value is reset when admin_password_encryption_ssh_key_id is set to an empty string.

Returned: when the API returns it

admin_password_encryption_ssh_key_id

string

UUID of the SSH RSA key that will be used to encrypt the initial admin password for OS requiring it. Mandatory for Windows OS. The public_key value of this key is used to encrypt the admin password. When set to an empty string, reset this value and admin_password_encrypted_value to an empty string so a new password may be generated.

Returned: when the API returns it

allowed_actions

list / elements=string

List of allowed actions on the Instance.

Returned: when the API returns it

arch

string

Instance architecture.

Returned: when the API returns it

boot_type

string

Instance boot type.

Returned: when the API returns it

commercial_type

string

Instance commercial type (eg. GP1-M).

Returned: when the API returns it

creation_date

string

Instance creation date. (RFC 3339 format)

Returned: when the API returns it

dns

string

Public DNS of the server.

Returned: when the API returns it

dynamic_ip_required

boolean

True if a dynamic IPv4 is required.

Returned: when the API returns it

enable_ipv6

boolean

True if IPv6 is enabled (deprecated and always `False` when `routed_ip_enabled` is `True`).

Deprecated by the Scaleway API contract.

Returned: when the API returns it

end_of_service

boolean

True if the Instance type has reached end of service.

Returned: when the API returns it

filesystems

list / elements=dictionary

List of attached filesystems.

Returned: when the API returns it

hostname

string

Instance host name.

Returned: when the API returns it

id

string

Instance unique ID.

Returned: when the API returns it

image

dictionary

Information about the Instance image.

Returned: when the API returns it

ipv6

dictionary

Instance IPv6 address (deprecated when `routed_ip_enabled` is `True`).

Deprecated by the Scaleway API contract.

Returned: when the API returns it

location

dictionary

Instance location.

Returned: when the API returns it

mac_address

string

The server’s MAC address.

Returned: when the API returns it

maintenances

list / elements=dictionary

Instance planned maintenance.

Returned: when the API returns it

modification_date

string

Instance modification date. (RFC 3339 format)

Returned: when the API returns it

name

string

Instance name.

Returned: when the API returns it

organization

string

Instance Organization ID.

Returned: when the API returns it

placement_group

dictionary

Instance placement group.

Returned: when the API returns it

private_ip

string

Private IP address of the Instance (deprecated and always `null` when `routed_ip_enabled` is `True`).

Returned: when the API returns it

private_nics

list / elements=dictionary

Instance private NICs.

Returned: when the API returns it

project

string

Instance Project ID.

Returned: when the API returns it

protected

boolean

Defines whether the Instance protection option is activated.

Returned: when the API returns it

public_ip

dictionary

Information about the public IP (deprecated in favor of `public_ips`).

Deprecated by the Scaleway API contract.

Returned: when the API returns it

public_ips

list / elements=dictionary

Information about all the public IPs attached to the server.

Returned: when the API returns it

routed_ip_enabled

boolean

True to configure the instance so it uses the routed IP mode. Use of `routed_ip_enabled` as `False` is deprecated.

Deprecated by the Scaleway API contract.

Returned: when the API returns it

security_group

dictionary

Instance security group.

Returned: when the API returns it

state

string

Instance state.

Returned: when the API returns it

state_detail

string

Detailed information about the Instance state.

Returned: when the API returns it

tags

list / elements=string

Tags associated with the Instance.

Returned: when the API returns it

volumes

dictionary

Instance volumes.

Returned: when the API returns it

zone

string

Zone in which the Instance is located.

Returned: when the API returns it

Authors

  • Stéphane Robert (@stephrobert)