cloudscale_ch.cloud.subnet module – Manages subnets on the cloudscale.ch IaaS service
Note
This module is part of the cloudscale_ch.cloud collection (version 2.3.1).
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.subnet
.
New in cloudscale_ch.cloud 1.3.0
Synopsis
Create, update and remove subnets.
Parameters
Parameter |
Comments |
---|---|
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: |
|
The cidr of the subnet. Required if state=present. |
|
A list of DNS resolver IP addresses, that act as DNS servers. If not set, the cloudscale.ch default resolvers are used. |
|
The gateway address of the subnet. If not set, no gateway is used. Cannot be within the DHCP range, which is the lowest .101-.254 in the subnet. |
|
The name of the network the subnet is related to. Required if state=present. |
|
The uuid of the network. |
|
The uuid of the network. |
|
The zone the network allocated in. |
|
Resets gateway_address and dns_servers to default values by the API. Note: Idempotency is not given. Choices:
|
|
State of the subnet. Choices:
|
|
Tags associated with the subnet. Set this to |
|
UUID of the subnet. |
Notes
Note
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 subnet exists
cloudscale_ch.cloud.subnet:
cidr: 172.16.0.0/24
network:
uuid: 2db69ba3-1864-4608-853a-0771b6885a3a
api_token: xxxxxx
- name: Ensure subnet exists
cloudscale_ch.cloud.subnet:
cidr: 192.168.1.0/24
gateway_address: 192.168.1.1
dns_servers:
- 192.168.1.10
- 192.168.1.11
network:
name: private
zone: lpg1
api_token: xxxxxx
- name: Ensure a subnet is absent
cloudscale_ch.cloud.subnet:
cidr: 172.16.0.0/24
network:
name: private
zone: lpg1
state: absent
api_token: xxxxxx
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
The CIDR of the subnet. Returned: success Sample: |
|
List of DNS resolver IP addresses. Returned: success Sample: |
|
The gateway address of the subnet. Returned: success Sample: |
|
API URL to get details about the subnet. Returned: success Sample: |
|
The network object of the subnet. Returned: success |
|
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: |
|
The zone the network is allocated in. Returned: success Sample: |
|
State of the subnet. Returned: success Sample: |
|
Tags associated with the subnet. Returned: success Sample: |
|
The unique identifier for the subnet. Returned: success Sample: |