cloudscale_floating_ip – Manages floating IPs on the cloudscale.ch IaaS service
New in version 2.5.
Synopsis
- Create, assign and delete floating IPs on the cloudscale.ch IaaS service.
Parameters
Parameter | Choices/Defaults | Comments |
---|---|---|
api_timeout - | Default: 30 | Timeout in seconds for calls to the cloudscale.ch API. |
api_token - | cloudscale.ch API token. This can also be passed in the CLOUDSCALE_API_TOKEN environment variable. | |
ip - | Floating IP address to change. Required to assign the IP to a different server or if state is absent. aliases: network | |
ip_version - |
| IP protocol version of the floating IP. |
prefix_length - |
| 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. |
reverse_ptr - | 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. | |
server - | UUID of the server assigned to this floating IP. Required unless state is absent. | |
state - |
| State of the floating IP. |
Notes
Note
- To create a new floating IP at least the
ip_version
andserver
options are required. - Once a floating_ip is created all parameters except
server
are read-only. - It’s not possible to request a floating IP without associating it with a server at the same time.
- This module requires the ipaddress python library. This library is included in Python since version 3.3. It is available as a module on PyPI for earlier versions.
- Instead of the api_token parameter the
CLOUDSCALE_API_TOKEN
environment variable can be used. - 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 - name: Request a floating IP cloudscale_floating_ip: ip_version: 4 server: 47cec963-fcd2-482f-bdb6-24461b2d47b1 reverse_ptr: my-server.example.com api_token: xxxxxx register: floating_ip # Assign an existing floating IP to a different server - name: Move floating IP to backup server cloudscale_floating_ip: ip: 192.0.2.123 server: ea3b39a3-77a8-4d0b-881d-0bb00a1e7f48 api_token: xxxxxx # Request a new floating IPv6 network - name: Request a floating IP cloudscale_floating_ip: ip_version: 6 prefix_length: 56 server: 47cec963-fcd2-482f-bdb6-24461b2d47b1 api_token: xxxxxx register: floating_ip # Assign an existing floating network to a different server - name: Move floating IP to backup server cloudscale_floating_ip: ip: '{{ floating_ip.network | ip }}' server: ea3b39a3-77a8-4d0b-881d-0bb00a1e7f48 api_token: xxxxxx # Release a floating IP - name: Release floating IP cloudscale_floating_ip: ip: 192.0.2.123 state: absent api_token: xxxxxx
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
href string | success when state == present | The API URL to get details about this floating IP. Sample: https://api.cloudscale.ch/v1/floating-ips/2001:db8::cafe |
ip string | success | The floating IP address or network. This is always present and used to identify floating IPs after creation. Sample: 185.98.122.176 |
network string | success when state == present | The CIDR notation of the network that is routed to your server. Sample: 2001:db8::cafe/128 |
next_hop string | success when state == present | Your floating IP is routed to this IP address. Sample: 2001:db8:dead:beef::42 |
reverse_ptr string | success when state == present | The reverse pointer for this floating IP address. Sample: 185-98-122-176.cust.cloudscale.ch |
server string | success when state == present | The floating IP is routed to this server. Sample: 47cec963-fcd2-482f-bdb6-24461b2d47b1 |
state string | success | The current status of the floating IP. Sample: present |
Status
- This module is not guaranteed to have a backwards compatible interface. [preview]
- This module is maintained by the Ansible Community. [community]
Authors
- Gaudenz Steinlin (@gaudenz) <gaudenz.steinlin@cloudscale.ch>
Hint
If you notice any issues in this documentation you can edit this document to improve it.
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.8/modules/cloudscale_floating_ip_module.html