cloudscale_ch.cloud.router module – Manages routers on the cloudscale.ch IaaS service

Note

This module is part of the cloudscale_ch.cloud collection (version 2.6.0).

You might already have this collection installed if you are using the ansible package. 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 cloudscale_ch.cloud.

To use it in a playbook, specify: cloudscale_ch.cloud.router.

New in cloudscale_ch.cloud 2.6.0

Synopsis

  • Create and remove routers.

Parameters

Parameter

Comments

api_timeout

integer

Timeout in seconds for calls to the cloudscale.ch API.

This can also be passed in the CLOUDSCALE_API_TIMEOUT environment variable.

Default: 45

api_token

string / required

cloudscale.ch API token.

This can also be passed in the CLOUDSCALE_API_TOKEN environment variable.

api_url

string

added in cloudscale_ch.cloud 1.3.0

cloudscale.ch API URL.

This can also be passed in the CLOUDSCALE_API_URL environment variable.

Default: "https://api.cloudscale.ch/v1"

internet_gateway

boolean

Whether this router acts as an internet gateway.

Choices:

  • false ← (default)

  • true

name

string

Name of the router.

Either name or uuid is required.

state

string

State of the router.

Choices:

  • "present" ← (default)

  • "absent"

tags

dictionary

Tags associated with the router. Set this to {} to clear any tags.

uuid

string

UUID of the router.

Either name or uuid is required.

zone

string

Zone slug of the router (e.g. lpg1 or rma1).

Notes

Note

  • Updates are not supported. Changing any parameter requires deleting and recreating the router.

  • All operations are performed using the cloudscale.ch public API v1.

  • For details consult the full API documentation: https://www.cloudscale.ch/en/api/v1.

  • A valid API token is required for all operations. You can create as many tokens as you like using the cloudscale.ch control panel at https://control.cloudscale.ch.

Examples

---
- name: Ensure a router exists
  cloudscale_ch.cloud.router:
    name: my-router
    zone: lpg1
    api_token: xxxxxx

- name: Ensure a router with internet gateway exists
  cloudscale_ch.cloud.router:
    name: my-internet-gateway
    zone: lpg1
    internet_gateway: true
    api_token: xxxxxx

- name: Ensure a router is absent
  cloudscale_ch.cloud.router:
    name: my-router
    state: absent
    api_token: xxxxxx

Return Values

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

Key

Description

created_at

string

The creation date and time of the router.

Returned: success

Sample: "2025-01-01T13:18:42.511407Z"

href

string

API URL to get details about this router.

Returned: success

Sample: "https://api.cloudscale.ch/v1/routers/cfde831a-4e87-4a75-960f-89b0148aa2cc"

interfaces

complex

List of interface objects attached to this router.

Returned: success

addresses

complex

List of address objects assigned to this interface.

Returned: success

address

string

The IP address assigned to the interface.

Returned: success

Sample: "172.20.160.103"

reverse_ptr

string

The reverse DNS pointer (PTR) for the address.

Returned: success

subnet

complex

The subnet the address belongs to.

Returned: success

cidr

string

The CIDR of the subnet.

Returned: success

Sample: "172.20.160.0/24"

href

string

API URL to get details about the subnet.

Returned: success

Sample: "https://api.cloudscale.ch/v1/subnets/9386e32c-4388-4709-a14e-0ec69ab9e354"

uuid

string

The unique identifier for the subnet.

Returned: success

Sample: "9386e32c-4388-4709-a14e-0ec69ab9e354"

version

integer

The IP version of the address (4 or 6).

Returned: success

Sample: 4

mac_address

string

The MAC address of the interface.

Returned: success

Sample: "fa:16:3e:67:31:6e"

network

complex

The network this interface is attached to.

Returned: success

href

string

API URL to get details about the network.

Returned: success

Sample: "https://api.cloudscale.ch/v1/networks/5e346d59-b671-4236-99cc-10cf49e7d56d"

name

string

The name of the network.

Returned: success

Sample: "my-network"

uuid

string

The unique identifier for the network.

Returned: success

Sample: "5e346d59-b671-4236-99cc-10cf49e7d56d"

type

string

The type of the interface (e.g. private).

Returned: success

Sample: "private"

uuid

string

The unique identifier for the interface.

Returned: success

Sample: "baeac2cc-94fd-4913-b7a5-d0e811f3e1ce"

internet_gateway

boolean

Whether this router acts as an internet gateway.

Returned: success

Sample: false

internet_gateway_addresses

complex

List of internet gateway address objects (populated when internet_gateway is true).

Returned: success

address

string

The internet gateway IP address.

Returned: success

Sample: "100.112.2.182"

reverse_ptr

string

The reverse DNS pointer (PTR) for the address.

Returned: success

Sample: "185-98-122-176.cust.cloudscale.ch"

subnet

complex

The subnet the address belongs to.

Returned: success

cidr

string

The CIDR of the subnet.

Returned: success

Sample: "172.16.0.0/24"

href

string

API URL to get details about the subnet.

Returned: success

Sample: "https://api.cloudscale.ch/v1/subnets/67b4bb7b-e595-4485-98e3-e48f5e1fae66"

uuid

string

The unique identifier for the subnet.

Returned: success

Sample: "67b4bb7b-e595-4485-98e3-e48f5e1fae66"

version

integer

The IP version of the address (4 or 6).

Returned: success

Sample: 4

name

string

The name of the router.

Returned: success

Sample: "my-router"

state

string

State of the router.

Returned: success

Sample: "present"

status

string

The status of the router.

Returned: success

Sample: "active"

tags

dictionary

Tags associated with the router.

Returned: success

Sample: {"project": "my project"}

uuid

string

The unique identifier for the router.

Returned: success

Sample: "cfde831a-4e87-4a75-960f-89b0148aa2cc"

zone

dictionary

The zone of the router.

Returned: success

Sample: {"slug": "lpg1"}

Authors

  • Michael Weibel (@mweibel)