ansible.builtin.cloudscale_floating_ip (v2.9.13) — module

Manages floating IPs on the cloudscale.ch IaaS service

| "added in version" 2.5 of ansible.builtin"

Authors: Gaudenz Steinlin (@gaudenz)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.13

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

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

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

api_url:
    default: https://api.cloudscale.ch/v1
    description:
    - cloudscale.ch API URL.
    - This can also be passed in the C(CLOUDSCALE_API_URL) environment variable.
    type: str
    version_added: 1.3.0
    version_added_collection: cloudscale_ch.cloud

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

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

api_timeout:
    default: 45
    description:
    - Timeout in seconds for calls to the cloudscale.ch API.
    - This can also be passed in the C(CLOUDSCALE_API_TIMEOUT) environment variable.
    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
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