hetzner.hcloud.rdns module – Create and manage reverse DNS entries on the Hetzner Cloud.

Note

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

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

Synopsis

  • Create, update and delete reverse DNS entries on the Hetzner Cloud.

Aliases: hcloud_rdns

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.

dns_ptr

string

The DNS address the ip_address should resolve to.

Omit the param to reset the reverse DNS entry to the default value.

floating_ip

string

Name or ID of the Hetzner Cloud Floating IP you want to add the reverse DNS entry to.

ip_address

string / required

The IP address that should point to dns_ptr.

load_balancer

string

Name or ID of the Hetzner Cloud Load Balancer you want to add the reverse DNS entry to.

primary_ip

string

Name or ID of the Hetzner Cloud Primary IP you want to add the reverse DNS entry to.

server

string

Name or ID of the Hetzner Cloud server you want to add the reverse DNS entry to.

state

string

State of the reverse DNS entry.

Choices:

  • "absent"

  • "present" ← (default)

See Also

See also

Documentation for Hetzner Cloud API

Complete reference for the Hetzner Cloud API.

Examples

- name: Create a reverse DNS entry for a server
  hetzner.hcloud.rdns:
    server: my-server
    ip_address: 123.123.123.123
    dns_ptr: example.com
    state: present

- name: Create a reverse DNS entry for a Floating IP
  hetzner.hcloud.rdns:
    floating_ip: my-floating-ip
    ip_address: 123.123.123.123
    dns_ptr: example.com
    state: present

- name: Create a reverse DNS entry for a Primary IP
  hetzner.hcloud.rdns:
    primary_ip: my-primary-ip
    ip_address: 123.123.123.123
    dns_ptr: example.com
    state: present

- name: Create a reverse DNS entry for a Load Balancer
  hetzner.hcloud.rdns:
    load_balancer: my-load-balancer
    ip_address: 123.123.123.123
    dns_ptr: example.com
    state: present

- name: Ensure the reverse DNS entry is absent (remove if needed)
  hetzner.hcloud.rdns:
    server: my-server
    ip_address: 123.123.123.123
    dns_ptr: example.com
    state: absent

Return Values

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

Key

Description

hcloud_rdns

complex

The reverse DNS entry

Returned: always

dns_ptr

string

The DNS that resolves to the IP

Returned: always

Sample: "example.com"

floating_ip

string

Name of the Floating IP

Returned: always

Sample: "my-floating-ip"

ip_address

string

The IP address that point to the DNS ptr

Returned: always

Sample: "123.123.123.123"

load_balancer

string

Name of the Load Balancer

Returned: always

Sample: "my-load-balancer"

primary_ip

string

Name of the Primary IP

Returned: always

Sample: "my-primary-ip"

server

string

Name of the server

Returned: always

Sample: "my-server"

Authors

  • Lukas Kaemmerling (@lkaemmerling)