stephrobert.scaleway.instance_server_action module – Perform an action on 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_action.

New in stephrobert.scaleway 0.1.0

Synopsis

  • Perform an action on an Instance. Available actions are: * `poweron`: Start a stopped Instance. * `poweroff`: Fully stop the Instance and release the hypervisor slot. * `stop_in_place`: Stop the Instance, but keep the slot on the hypervisor. * `reboot`: Stop the instance and restart it.

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.

action

string / required

Action to perform on the Instance.

Choices:

  • "poweron"

  • "poweroff"

  • "reboot"

  • "stop_in_place"

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.

config_file

path

Path to the Scaleway configuration file.

organization_id

string

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

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.

secret_key

string

Scaleway API secret key.

server_id

string / required

UUID of the Instance.

user_agent

string

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

wait

boolean

Wait for the action to reach its expected state before returning.

When false, the module returns as soon as the API accepts the action.

Choices:

  • false

  • true ← (default)

wait_timeout

integer

How long to wait for the expected state, in seconds.

Default: 300

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 reports the action it would trigger and sends nothing, without even building an API client.

diff_mode

Support: none

An action is a trigger rather than a state, so there is no before and after to compare.

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

# An action is a trigger, not a state: running this a second time
# reports `changed` again, and that is correct. Idempotence is the
# business of the management modules.
#
# The module waits until the API reports the target state before
# returning, so the next task acts on a resource that has settled.

- name: Poweron the Instance server
  stephrobert.scaleway.instance_server_action:
    zone: fr-par-1
    server_id: 11111111-2222-3333-4444-555555555555
    action: poweron
  register: result
- name: Poweroff the Instance server
  stephrobert.scaleway.instance_server_action:
    zone: fr-par-1
    server_id: 11111111-2222-3333-4444-555555555555
    action: poweroff
  register: result
- name: Reboot the Instance server
  stephrobert.scaleway.instance_server_action:
    zone: fr-par-1
    server_id: 11111111-2222-3333-4444-555555555555
    action: reboot
  register: result
- name: Stop in place the Instance server
  stephrobert.scaleway.instance_server_action:
    zone: fr-par-1
    server_id: 11111111-2222-3333-4444-555555555555
    action: stop_in_place
  register: result

Return Values

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

Key

Description

action

string

The action that was requested.

Returned: always

state

string

State of the resource once the action completed.

Returned: when the module waited for the action to complete

task

dictionary

Perform an action on an Instance. Available actions are: * `poweron`: Start a stopped Instance. * `poweroff`: Fully stop the Instance and release the hypervisor slot. * `stop_in_place`: Stop the Instance, but keep the slot on the hypervisor. * `reboot`: Stop the instance and restart it.

Returned: when the API returns it

description

string

Description of the task.

Deprecated by the Scaleway API contract.

Returned: when the API returns it

href_from

string

Source reference of the task, as the API returns it.

Returned: when the API returns it

href_result

string

Location of the resulting resource.

Returned: when the API returns it

id

string

Unique ID of the task.

Deprecated by the Scaleway API contract.

Returned: when the API returns it

progress

integer

Progress of the task in percent.

Deprecated by the Scaleway API contract.

Returned: when the API returns it

started_at

string

Task start date. (RFC 3339 format)

Deprecated by the Scaleway API contract.

Returned: when the API returns it

status

string

Task status.

Deprecated by the Scaleway API contract.

Returned: when the API returns it

terminated_at

string

Task end date. (RFC 3339 format)

Deprecated by the Scaleway API contract.

Returned: when the API returns it

zone

string

Zone in which the task is executed.

Deprecated by the Scaleway API contract.

Returned: when the API returns it

Authors

  • Stéphane Robert (@stephrobert)