cloudscale_ch.cloud.floating_ip (2.3.1) — module

Manages floating IPs on the cloudscale.ch IaaS service

| "added in version" 1.0.0 of cloudscale_ch.cloud"

Authors: Gaudenz Steinlin (@gaudenz), Denis Krienbühl (@href), René Moser (@resmo)

Install collection

Install with ansible-galaxy collection install cloudscale_ch.cloud:==2.3.1


Add to requirements.yml

  collections:
    - name: cloudscale_ch.cloud
      version: 2.3.1

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 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# 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
  • 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_ch.cloud.floating_ip:
    ip: '{{ floating_ip.ip }}'
    server: ea3b39a3-77a8-4d0b-881d-0bb00a1e7f48
    api_token: xxxxxx
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Remove a floating IP
- name: Release floating IP
  cloudscale_ch.cloud.floating_ip:
    ip: 192.0.2.123
    state: absent
    api_token: xxxxxx
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# 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

Inputs

    
name:
    description:
    - Name to identifiy the floating IP address for idempotency.
    - One of I(network) or I(name) is required to identify the floating IP.
    - Required for assigning a new floating IP.
    type: str
    version_added: 1.3.0
    version_added_collection: cloudscale_ch.cloud

tags:
    description:
    - Tags associated with the floating IP. Set this to C({}) to clear any tags.
    type: dict
    version_added: 1.1.0
    version_added_collection: cloudscale_ch.cloud

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(lpg) 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

server:
    description:
    - UUID of the server assigned to this floating IP.
    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

network:
    aliases:
    - ip
    description:
    - Floating IP address to change.
    - One of I(network) or I(name) is required to identify the floating IP.
    type: str

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.
    - Required when assigning a new 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.
  returned: success when state == present
  sample: 185.98.122.176
  type: str
name:
  description: The name of the floating IP.
  returned: success
  sample: my floating ip
  type: str
  version_added: 1.3.0
  version_added_collection: cloudscale_ch.cloud
network:
  description: The CIDR notation of the network that is routed to your server.
  returned: success
  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
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
tags:
  description: Tags assosiated with the floating IP.
  returned: success
  sample:
    project: my project
  type: dict
  version_added: 1.1.0
  version_added_collection: cloudscale_ch.cloud