community.general.cloudscale_floating_ip (0.1.4) — module

Manages floating IPs on the cloudscale.ch IaaS service

Authors: Gaudenz Steinlin (@gaudenz), Denis Krienbühl (@href)

Install collection

Install with ansible-galaxy collection install community.general:==0.1.4


Add to requirements.yml

  collections:
    - name: community.general
      version: 0.1.4

Description

Create, assign and delete floating IPs on the cloudscale.ch IaaS service.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# 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
    region: lpg1
  register: floating_ip
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Release a floating IP
- name: Release floating IP
  cloudscale_floating_ip:
    ip: 192.0.2.123
    state: absent
    api_token: xxxxxx

Inputs

    
ip:
    aliases:
    - network
    description:
    - Floating IP address to change.
    - Required to assign the IP to a different server or if I(state) is absent.
    type: str

type:
    choices:
    - regional
    - global
    default: regional
    description:
    - The type of the floating IP.
    type: str

state:
    choices:
    - present
    - absent
    default: present
    description:
    - State of the floating IP.
    type: str

region:
    description:
    - Region in which the floating IP resides (e.g. C(lgp) or C(rma)). If omitted, the
      region of the project default zone is used. This parameter must be omitted if I(type)
      is set to C(global).
    type: str
    version_added: 0.2.0
    version_added_collection: community.general

server:
    description:
    - UUID of the server assigned to this floating IP.
    - Required unless I(state) is absent.
    type: str

api_token:
    description:
    - cloudscale.ch API token.
    - This can also be passed in the C(CLOUDSCALE_API_TOKEN) environment variable.
    type: str

ip_version:
    choices:
    - 4
    - 6
    description:
    - IP protocol version of the floating IP.
    type: int

api_timeout:
    default: 30
    description:
    - Timeout in seconds for calls to the cloudscale.ch API.
    type: int

reverse_ptr:
    description:
    - 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.
    type: str

prefix_length:
    choices:
    - 56
    description:
    - Only valid if I(ip_version) is 6.
    - Prefix length for the IPv6 network. Currently only a prefix of /56 can be requested.
      If no I(prefix_length) is present, a single address is created.
    type: int

Outputs

href:
  description: The API URL to get details about this floating IP.
  returned: success when state == present
  sample: https://api.cloudscale.ch/v1/floating-ips/2001:db8::cafe
  type: str
ip:
  description: The floating IP address or network. This is always present and used
    to identify floating IPs after creation.
  returned: success
  sample: 185.98.122.176
  type: str
network:
  description: The CIDR notation of the network that is routed to your server.
  returned: success when state == present
  sample: 2001:db8::cafe/128
  type: str
next_hop:
  description: Your floating IP is routed to this IP address.
  returned: success when state == present
  sample: 2001:db8:dead:beef::42
  type: str
region:
  description: The region of the floating IP.
  returned: success when state == present
  sample:
    slug: lpg
  type: dict
  version_added: 0.2.0
  version_added_collection: community.general
reverse_ptr:
  description: The reverse pointer for this floating IP address.
  returned: success when state == present
  sample: 185-98-122-176.cust.cloudscale.ch
  type: str
server:
  description: The floating IP is routed to this server.
  returned: success when state == present
  sample: 47cec963-fcd2-482f-bdb6-24461b2d47b1
  type: str
state:
  description: The current status of the floating IP.
  returned: success
  sample: present
  type: str