ansible.builtin.hcloud_subnetwork (v2.9.25) — module

Manage cloud subnetworks on the Hetzner Cloud.

| "added in version" 2.9 of ansible.builtin"

Authors: Lukas Kaemmerling (@lkaemmerling)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.25

Description

Create, update and delete cloud subnetworks on the Hetzner Cloud.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a basic subnetwork
  hcloud_subnetwork:
    network: my-network
    ip_range: 10.0.0.0/16
    network_zone: eu-central
    type: server
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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: server
    state: absent

Inputs

    
type:
    description:
    - Type of subnetwork.
    required: true
    type: str

state:
    choices:
    - absent
    - present
    default: present
    description:
    - State of the subnetwork.
    type: str

network:
    description:
    - The ID or Name  of the Hetzner Cloud Networks.
    required: true
    type: str

endpoint:
    default: https://api.hetzner.cloud/v1
    description:
    - This is the API Endpoint for the Hetzner Cloud.
    type: str

ip_range:
    description:
    - IP range of the subnetwork.
    required: true
    type: str

api_token:
    description:
    - This is the API Token for the Hetzner Cloud.
    required: true
    type: str

network_zone:
    description:
    - Name of network zone.
    required: true
    type: str

Outputs

hcloud_subnetwork:
  contains:
    gateway:
      description: Gateway of the subnetwork
      returned: always
      sample: 10.0.0.1
      type: str
    ip_range:
      description: IP range of the Network
      returned: always
      sample: 10.0.0.0/8
      type: str
    network:
      description: Name of the Network
      returned: always
      sample: my-network
      type: str
    network_zone:
      description: Name of network zone
      returned: always
      sample: eu-central
      type: str
    type:
      description: Type of subnetwork
      returned: always
      sample: server
      type: str
  description: One Subnet of a Network
  returned: always
  type: complex

See also