hetzner.hcloud.network_member_info module – Gather info about your Hetzner Cloud Network Members.

Note

This module is part of the hetzner.hcloud collection (version 7.2.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. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: hetzner.hcloud.network_member_info.

Synopsis

  • Gather info about your Hetzner Cloud Network Members.

Requirements

The below requirements are needed on the host that executes this module.

  • python-dateutil >= 2.7.5

  • requests >=2.20

Parameters

Parameter

Comments

api_endpoint

aliases: endpoint

string

The endpoint for the Hetzner Cloud API.

You can also set this option by using the HCLOUD_ENDPOINT environment variable.

Default: "https://api.hetzner.cloud/v1"

api_endpoint_hetzner

string

The endpoint for the Hetzner API.

You can also set this option by using the HETZNER_ENDPOINT environment variable.

Default: "https://api.hetzner.com/v1"

api_token

string / required

The token for the Hetzner Cloud API.

You can also set this option by using the HCLOUD_TOKEN environment variable.

network

string / required

ID or Name of the Network to list the members of.

Using the ID is preferred, to reduce the amount of API requests.

status

list / elements=string

Filter members by status. May be used multiple times.

Choices:

  • "ok"

  • "attaching"

  • "detaching"

  • "updating"

  • "error"

subnet

list / elements=string

Filter members by subnet. May be used multiple times.

type

list / elements=string

Filter members by type. May be used multiple times.

Choices:

  • "server"

  • "load_balancer"

See Also

See also

Documentation for Hetzner APIs

Complete reference for the Hetzner APIs.

Examples

- name: Gather Network Member infos
  hetzner.hcloud.network_member_info:
    network: my-network
    type: [server, load_balancer]
    status: [ok, attaching, detaching, updating, error]
    subnet: [10.0.1.0/24]
  register: output

- name: Print the gathered infos
  debug:
    var: output.hcloud_network_member_info

- name: Collect all Network Member ips
  ansible.builtin.set_fact:
  network_ips: >
    {{
      output.hcloud_network_member_info | map(attribute='ip') +
      output.hcloud_network_member_info | map(attribute='alias_ips') | flatten
    }}

- name: Print all Network Member ips
  debug:
    var: network_ips

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

hcloud_network_member_info

list / elements=string

Network Members infos as list.

Returned: always

alias_ips

list / elements=string

Additional IP addresses of the Resource within the Network.

Returned: always

Sample: ["10.0.1.4", "10.0.1.7"]

id

integer

ID of the Resource attached to the Network.

Returned: always

Sample: 1937415

ip

string

IP address of the Resource within the Network.

Returned: always

Sample: "10.0.1.2"

status

string

Status of the Resource within the Network.

Returned: always

Sample: "ok"

subnet

string

IP range of the subnet the Resource is attached to.

Returned: always

Sample: "10.0.1.0/24"

type

string

Type of the Resource attached to the Network.

Returned: always

Sample: "server"

Authors

  • Jonas Lammler (@jooola)