hetzner.hcloud.hcloud_primary_ip module – Create and manage cloud Primary IPs on the Hetzner Cloud.
Note
This module is part of the hetzner.hcloud collection (version 1.16.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.hcloud_primary_ip
.
New in hetzner.hcloud 1.8.0
Synopsis
Create, update and manage cloud Primary IPs on the Hetzner Cloud.
Requirements
The below requirements are needed on the host that executes this module.
hcloud-python >= 1.9.0
python-dateutil >= 2.7.5
requests >=2.20
Parameters
Parameter |
Comments |
---|---|
This is the API Token for the Hetzner Cloud. You can also set this option by using the environment variable HCLOUD_TOKEN |
|
Delete this Primary IP when the resource it is assigned to is deleted Choices:
|
|
Home Location of the Hetzner Cloud Primary IP. Required if no server is given and Primary IP does not exist. |
|
Protect the Primary IP for deletion. Choices:
|
|
This is the API Endpoint for the Hetzner Cloud. Default: |
|
The ID of the Hetzner Cloud Primary IPs to manage. Only required if no Primary IP name is given. |
|
User-defined labels (key-value pairs). |
|
The Name of the Hetzner Cloud Primary IPs to manage. Only required if no Primary IP id is given or a Primary IP does not exist. |
|
State of the Primary IP. Choices:
|
|
Type of the Primary IP. Required if Primary IP does not exist Choices:
|
See Also
See also
- Documentation for Hetzner Cloud API
Complete reference for the Hetzner Cloud API.
Examples
- name: Create a basic IPv4 Primary IP
hcloud_primary_ip:
name: my-primary-ip
datacenter: fsn1-dc14
type: ipv4
state: present
- name: Create a basic IPv6 Primary IP
hcloud_primary_ip:
name: my-primary-ip
datacenter: fsn1-dc14
type: ipv6
state: present
- name: Primary IP should be absent
hcloud_primary_ip:
name: my-primary-ip
state: absent
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
The Primary IP instance Returned: Always |
|
Name of the datacenter of the Primary IP Returned: Always Sample: |
|
True if Primary IP is protected for deletion Returned: always Sample: |
|
ID of the Primary IP Returned: Always Sample: |
|
IP Address of the Primary IP Returned: Always Sample: |
|
User-defined labels (key-value pairs) Returned: Always Sample: |
|
Name of the Primary IP Returned: Always Sample: |
|
Type of the Primary IP Returned: Always Sample: |