community.digitalocean.digital_ocean_floating_ip (1.26.0) — module

Manage DigitalOcean Floating IPs

Authors: Patrick Marques (@pmarques), Daniel George (@danxg87)

Install collection

Install with ansible-galaxy collection install community.digitalocean:==1.26.0


Add to requirements.yml

  collections:
    - name: community.digitalocean
      version: 1.26.0

Description

Create/delete/assign a floating IP.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "Create a Floating IP in region lon1"
  community.digitalocean.digital_ocean_floating_ip:
    state: present
    region: lon1
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a Floating IP in region lon1 (and assign to Project "test")
  community.digitalocean.digital_ocean_floating_ip:
    state: present
    region: lon1
    project: test
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "Create a Floating IP assigned to Droplet ID 123456"
  community.digitalocean.digital_ocean_floating_ip:
    state: present
    droplet_id: 123456
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "Attach an existing Floating IP of 1.2.3.4 to Droplet ID 123456"
  community.digitalocean.digital_ocean_floating_ip:
    state: attached
    ip: "1.2.3.4"
    droplet_id: 123456
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "Detach an existing Floating IP of 1.2.3.4 from its Droplet"
  community.digitalocean.digital_ocean_floating_ip:
    state: detached
    ip: "1.2.3.4"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "Delete a Floating IP with ip 1.2.3.4"
  community.digitalocean.digital_ocean_floating_ip:
    state: absent
    ip: "1.2.3.4"

Inputs

    
ip:
    aliases:
    - id
    description:
    - Public IP address of the Floating IP. Used to remove an IP
    type: str

state:
    choices:
    - present
    - absent
    - attached
    - detached
    default: present
    description:
    - Indicate desired state of the target.
    - If C(state=present) Create (and optionally attach) floating IP
    - If C(state=absent) Delete floating IP
    - If C(state=attached) attach floating IP to a droplet
    - If C(state=detached) detach floating IP from a droplet
    type: str

region:
    description:
    - The region that the Floating IP is reserved to.
    type: str

timeout:
    default: 30
    description:
    - Floating IP creation timeout.
    type: int

droplet_id:
    description:
    - The Droplet that the Floating IP has been assigned to.
    type: str

oauth_token:
    description:
    - DigitalOcean OAuth token.
    required: true
    type: str

project_name:
    aliases:
    - project
    default: ''
    description:
    - Project to assign the resource to (project name, not UUID).
    - Defaults to the default project of the account (empty string).
    - Currently only supported when creating.
    required: false
    type: str

validate_certs:
    default: true
    description:
    - If set to C(no), the SSL certificates will not be validated.
    - This should only set to C(no) used on personally controlled sites using self-signed
      certificates.
    type: bool

Outputs

assign_status:
  description: Assignment status (ok, not_found, assigned, already_assigned, service_down)
  returned: changed
  sample: assigned
  type: str
data:
  description: a DigitalOcean Floating IP resource
  returned: success and no resource constraint
  sample:
    action:
      completed_at: null
      id: 68212728
      region:
        available: true
        features:
        - private_networking
        - backups
        - ipv6
        - metadata
        name: New York 3
        sizes:
        - 512mb,
        - 1gb,
        - 2gb,
        - 4gb,
        - 8gb,
        - 16gb,
        - 32gb,
        - 48gb,
        - 64gb
        slug: nyc3
      region_slug: nyc3
      resource_id: 758603823
      resource_type: floating_ip
      started_at: '2015-10-15T17:45:44Z'
      status: in-progress
      type: assign_ip
  type: dict
msg:
  description: Informational or error message encountered during execution
  returned: changed
  sample: No project named test2 found
  type: str
resources:
  description: Resource assignment involved in project assignment
  returned: changed
  sample:
    assigned_at: '2021-10-25T17:39:38Z'
    links:
      self: https://api.digitalocean.com/v2/floating_ips/157.230.64.107
    status: assigned
    urn: do:floatingip:157.230.64.107
  type: dict