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

Create and manage cloud Networks 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 manage cloud Networks on the Hetzner Cloud.

You need at least hcloud-python 1.3.0.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a basic network
  hcloud_network:
    name: my-network
    ip_range: 10.0.0.0/8
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Ensure the Network is absent (remove if needed)
  hcloud_network:
    name: my-network
    state: absent

Inputs

    
id:
    description:
    - The ID of the Hetzner Cloud Networks to manage.
    - Only required if no Network I(name) is given.
    type: int

name:
    description:
    - The Name of the Hetzner Cloud Network to manage.
    - Only required if no Network I(id) is given or a Network does not exists.
    type: str

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

labels:
    description:
    - User-defined labels (key-value pairs).
    type: dict

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 Network.
    - Required if Network does not exists.
    type: str

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

Outputs

hcloud_network:
  contains:
    id:
      description: ID of the Network
      returned: always
      sample: 12345
      type: int
    ip_range:
      description: IP range of the Network
      returned: always
      sample: 10.0.0.0/8
      type: str
    labels:
      description: User-defined labels (key-value pairs)
      returned: always
      sample:
        key: value
        mylabel: 123
      type: dict
    name:
      description: Name of the Network
      returned: always
      sample: my-volume
      type: str
  description: The Network
  returned: always
  type: complex

See also