cloudscale_ch.cloud.interface module – Manages network interfaces 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.interface.
New in cloudscale_ch.cloud 2.6.0
Synopsis
Create and remove network interfaces attached to routers.
Parameters
Parameter |
Comments |
|---|---|
List of address configurations for the interface. Required when state=present. |
|
The IP address to assign. |
|
UUID of the subnet. |
|
Timeout in seconds for calls to the cloudscale.ch API. This can also be passed in the Default: |
|
cloudscale.ch API token. This can also be passed in the |
|
cloudscale.ch API URL. This can also be passed in the Default: |
|
UUID of the network to attach. Used as the idempotency key to identify the interface within the router. |
|
UUID of the router to attach the interface to. |
|
State of the interface. Choices:
|
Notes
Note
Updates are not supported. Changing any parameter requires deleting and recreating the interface.
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 router exists
cloudscale_ch.cloud.router:
name: "{{ resource_prefix }}-router"
zone: "{{ cloudscale_zone }}"
internet_gateway: false
register: router
- name: Attach a network interface with a specific IP address
cloudscale_ch.cloud.interface:
router: '{{ router.uuid }}'
network: '{{ network.uuid }}'
addresses:
- subnet: '{{ subnet.uuid }}'
address: '172.16.0.1'
api_token: xxxxxx
- name: Remove a network interface from a router
cloudscale_ch.cloud.interface:
router: '{{ router.uuid }}'
network: '{{ network.uuid }}'
state: absent
api_token: xxxxxx
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
List of address objects assigned to this interface. Returned: success when not state == absent |
|
The IP address assigned to the interface. Returned: success Sample: |
|
The reverse DNS pointer (PTR) for the address. Returned: success Sample: |
|
The subnet the address belongs to. Returned: success |
|
The CIDR of the subnet. Returned: success Sample: |
|
API URL to get details about the subnet. Returned: success Sample: |
|
The unique identifier for the subnet. Returned: success Sample: |
|
The IP version of the address ( Returned: success Sample: |
|
The MAC address of the interface. Returned: success when not state == absent Sample: |
|
The network this interface is attached to. Returned: success when not state == absent |
|
API URL to get details about the network. Returned: success Sample: |
|
The name of the network. Returned: success Sample: |
|
The unique identifier for the network. Returned: success Sample: |
|
State of the interface. Returned: success Sample: |
|
The type of the interface (e.g. Returned: success when not state == absent Sample: |
|
The unique identifier for the interface. Returned: success when not state == absent Sample: |