hetzner.hcloud.hcloud_subnetwork – Manage cloud subnetworks on the Hetzner Cloud.
Note
This plugin is part of the hetzner.hcloud collection (version 1.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 hetzner.hcloud
.
To use it in a playbook, specify: hetzner.hcloud.hcloud_subnetwork
.
Requirements
The below requirements are needed on the host that executes this module.
hcloud-python >= 1.0.0
hcloud-python >= 1.10.0
Parameters
Parameter |
Comments |
---|---|
This is the API Token for the Hetzner Cloud. |
|
This is the API Endpoint for the Hetzner Cloud. Default: “https://api.hetzner.cloud/v1” |
|
IP range of the subnetwork. |
|
The ID or Name of the Hetzner Cloud Networks. |
|
Name of network zone. |
|
State of the subnetwork. Choices:
|
|
Type of subnetwork. Choices:
|
|
ID of the vSwitch you want to couple with your Network. Required if type == vswitch |
See Also
See also
- Documentation for Hetzner Cloud API
Complete reference for the Hetzner Cloud API.
Examples
- name: Create a basic subnetwork
hcloud_subnetwork:
network: my-network
ip_range: 10.0.0.0/16
network_zone: eu-central
type: cloud
state: present
- name: Create a basic subnetwork
hcloud_subnetwork:
network: my-vswitch-network
ip_range: 10.0.0.0/24
network_zone: eu-central
type: vswitch
vswitch_id: 123
state: present
- name: Ensure the subnetwork is absent (remove if needed)
hcloud_subnetwork:
network: my-network
ip_range: 10.0.0.0/8
network_zone: eu-central
type: cloud
state: absent
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
One Subnet of a Network Returned: always |
|
Gateway of the subnetwork Returned: always Sample: “10.0.0.1” |
|
IP range of the Network Returned: always Sample: “10.0.0.0/8” |
|
Name of the Network Returned: always Sample: “my-network” |
|
Name of network zone Returned: always Sample: “eu-central” |
|
Type of subnetwork Returned: always Sample: “server” |
|
ID of the vswitch, null if not type vswitch Returned: always Sample: 123 |
Authors
Lukas Kaemmerling (@lkaemmerling)