cloudscale_ch.cloud.floating_ip module – Manages floating IPs on the cloudscale.ch IaaS service
Note
This module is part of the cloudscale_ch.cloud collection (version 2.3.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 cloudscale_ch.cloud
.
To use it in a playbook, specify: cloudscale_ch.cloud.floating_ip
.
New in cloudscale_ch.cloud 1.0.0
Synopsis
Create, assign and delete floating IPs on the cloudscale.ch IaaS service.
Aliases: cloudscale_floating_ip
Parameters
Parameter |
Comments |
---|---|
Timeout in seconds for calls to the cloudscale.ch API. This can also be passed in the Default: |
|
cloudscale.ch API token. This can also be passed in the |
|
cloudscale.ch API URL. This can also be passed in the Default: |
|
IP protocol version of the floating IP. Required when assigning a new floating IP. Choices:
|
|
Name to identifiy the floating IP address for idempotency. One of network or name is required to identify the floating IP. Required for assigning a new floating IP. |
|
Floating IP address to change. One of network or name is required to identify the floating IP. |
|
Only valid if ip_version is 6. Prefix length for the IPv6 network. Currently only a prefix of /56 can be requested. If no prefix_length is present, a single address is created. Choices:
|
|
Region in which the floating IP resides (e.g. |
|
Reverse PTR entry for this address. You cannot set a reverse PTR entry for IPv6 floating networks. Reverse PTR entries are only allowed for single addresses. |
|
UUID of the server assigned to this floating IP. |
|
State of the floating IP. Choices:
|
|
Tags associated with the floating IP. Set this to |
|
The type of the floating IP. Choices:
|
Notes
Note
Once a floating_ip is created, all parameters except
server
,reverse_ptr
andtags
are read-only.All operations are performed using the cloudscale.ch public API v1.
For details consult the full API documentation: https://www.cloudscale.ch/en/api/v1.
A valid API token is required for all operations. You can create as many tokens as you like using the cloudscale.ch control panel at https://control.cloudscale.ch.
Examples
# Request a new floating IP without assignment to a server
- name: Request a floating IP
cloudscale_ch.cloud.floating_ip:
name: IP to my server
ip_version: 4
reverse_ptr: my-server.example.com
api_token: xxxxxx
# Request a new floating IP with assignment
- name: Request a floating IP
cloudscale_ch.cloud.floating_ip:
name: web
ip_version: 4
server: 47cec963-fcd2-482f-bdb6-24461b2d47b1
reverse_ptr: my-server.example.com
api_token: xxxxxx
# Assign an existing floating IP to a different server by its IP address
- name: Move floating IP to backup server
cloudscale_ch.cloud.floating_ip:
ip: 192.0.2.123
server: ea3b39a3-77a8-4d0b-881d-0bb00a1e7f48
api_token: xxxxxx
# Assign an existing floating IP to a different server by name
- name: Move floating IP to backup server
cloudscale_ch.cloud.floating_ip:
name: IP to my server
server: ea3b39a3-77a8-4d0b-881d-0bb00a1e7f48
api_token: xxxxxx
# Request a new floating IPv6 network
- name: Request a floating IP
cloudscale_ch.cloud.floating_ip:
name: IPv6 to my server
ip_version: 6
prefix_length: 56
server: 47cec963-fcd2-482f-bdb6-24461b2d47b1
api_token: xxxxxx
region: lpg1
# Assign an existing floating network to a different server
- name: Move floating IP to backup server
cloudscale_ch.cloud.floating_ip:
ip: '{{ floating_ip.ip }}'
server: ea3b39a3-77a8-4d0b-881d-0bb00a1e7f48
api_token: xxxxxx
# Remove a floating IP
- name: Release floating IP
cloudscale_ch.cloud.floating_ip:
ip: 192.0.2.123
state: absent
api_token: xxxxxx
# Remove a floating IP by name
- name: Release floating IP
cloudscale_ch.cloud.floating_ip:
name: IP to my server
state: absent
api_token: xxxxxx
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
The API URL to get details about this floating IP. Returned: success when state == present Sample: |
|
The floating IP address. Returned: success when state == present Sample: |
|
The name of the floating IP. Returned: success Sample: |
|
The CIDR notation of the network that is routed to your server. Returned: success Sample: |
|
Your floating IP is routed to this IP address. Returned: success when state == present Sample: |
|
The region of the floating IP. Returned: success when state == present Sample: |
|
The reverse pointer for this floating IP address. Returned: success when state == present Sample: |
|
The floating IP is routed to this server. Returned: success when state == present Sample: |
|
The current status of the floating IP. Returned: success Sample: |
|
Tags assosiated with the floating IP. Returned: success Sample: |