hetzner.hcloud.floating_ip module – Create and manage cloud Floating IPs on the Hetzner Cloud.

Note

This module is part of the hetzner.hcloud collection (version 4.2.2).

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.floating_ip.

New in hetzner.hcloud 0.1.0

Synopsis

  • Create, update and manage cloud Floating IPs on the Hetzner Cloud.

Aliases: hcloud_floating_ip

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 API Endpoint for the Hetzner Cloud.

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

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

api_token

string / required

The API Token for the Hetzner Cloud.

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

delete_protection

boolean

Protect the Floating IP for deletion.

Choices:

  • false

  • true

description

string

The Description of the Hetzner Cloud Floating IPs.

force

boolean

Force the assignment or deletion of the Floating IP.

Choices:

  • false

  • true

home_location

string

Home Location of the Hetzner Cloud Floating IP.

Required if no server is given and Floating IP does not exist.

id

integer

The ID of the Hetzner Cloud Floating IPs to manage.

Only required if no Floating IP name is given.

labels

dictionary

User-defined labels (key-value pairs).

name

string

The Name of the Hetzner Cloud Floating IPs to manage.

Only required if no Floating IP id is given or a Floating IP does not exist.

server

string

Server Name the Floating IP should be assigned to.

Required if no home_location is given and Floating IP does not exist.

state

string

State of the Floating IP.

Choices:

  • "absent"

  • "present" ← (default)

type

string

Type of the Floating IP.

Required if Floating IP does not exist

Choices:

  • "ipv4"

  • "ipv6"

See Also

See also

Documentation for Hetzner Cloud API

Complete reference for the Hetzner Cloud API.

Examples

- name: Create a basic IPv4 Floating IP
  hetzner.hcloud.floating_ip:
    name: my-floating-ip
    home_location: fsn1
    type: ipv4
    state: present
- name: Create a basic IPv6 Floating IP
  hetzner.hcloud.floating_ip:
    name: my-floating-ip
    home_location: fsn1
    type: ipv6
    state: present
- name: Assign a Floating IP to a server
  hetzner.hcloud.floating_ip:
    name: my-floating-ip
    server: 1234
    state: present
- name: Assign a Floating IP to another server
  hetzner.hcloud.floating_ip:
    name: my-floating-ip
    server: 1234
    force: true
    state: present
- name: Floating IP should be absent
  hetzner.hcloud.floating_ip:
    name: my-floating-ip
    state: absent

Return Values

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

Key

Description

hcloud_floating_ip

complex

The Floating IP instance

Returned: Always

delete_protection

boolean

added in hetzner.hcloud 0.1.0

True if Floating IP is protected for deletion

Returned: always

Sample: false

description

string

Description of the Floating IP

Returned: Always

Sample: "my-floating-ip"

home_location

string

Name of the home location of the Floating IP

Returned: Always

Sample: "fsn1"

id

integer

ID of the Floating IP

Returned: Always

Sample: 12345

ip

string

IP Address of the Floating IP

Returned: Always

Sample: "116.203.104.109"

labels

dictionary

User-defined labels (key-value pairs)

Returned: Always

Sample: {"key": "value", "mylabel": 123}

name

string

Name of the Floating IP

Returned: Always

Sample: "my-floating-ip"

server

string

Name of the server the Floating IP is assigned to.

Returned: Always

Sample: "my-server"

type

string

Type of the Floating IP

Returned: Always

Sample: "ipv4"

Authors

  • Lukas Kaemmerling (@lkaemmerling)