reserved_ip_assign
Generated on 16 Dec 2025
from digitalocean.cloud version
v1.2.1
Synopsis
Create a reserved IP without assigning it. Create a reserved IP and assign it to a Droplet. Assign an existing reserved IP to a Droplet. Unassign and delete a reserved IP. View the API documentation at https://docs.digitalocean.com/reference/api/api-reference/#operation/assign_reserved_ip.
Requirements
- pydo >= 0.1.3
- azure-core >= 1.26.1
Parameters
| Parameter | Choices / Default | Description |
|---|---|---|
client_override_optionsdict |
Client override options (developer use). For example, can be used to override the DigitalOcean API endpoint for an internal test suite. If provided, these options will knock out existing options. | |
droplet_idint |
A unique identifier for a Droplet instance. The Droplet that the reserved IP will be assigned to. If provided, name and region are ignored. Required when reserved_ip is provided and state=present. Not used when state=absent. |
|
module_override_optionsdict |
Module override options (developer use). Can be used to override module options to support experimental or future options. If provided, these options will knock out existing options. | |
namestr |
The name of the Droplet to assign the reserved IP to. If provided, must be unique and given with region. Required when reserved_ip is provided and state=present. Not used when state=absent. |
|
regionstr |
The region slug where the Droplet is located or where the reserved IP should be created. Required with name. Required when creating an unassigned reserved IP. Not used when state=absent. |
|
reserved_ipstr |
The reserved IP address to assign or delete. If not provided, a new reserved IP will be created (only when state=present). Required when state=absent. Aliases floating_ip. |
|
statestr |
Choices:
|
Whether the reserved IP should be assigned or deleted. When present, the reserved IP will be created and/or assigned. When absent, the reserved IP will be unassigned (if assigned) and then deleted. |
timeoutint |
Default: 300 |
Polling timeout in seconds. |
tokenstr |
DigitalOcean API token. There are several environment variables which can be used to provide this value. DIGITALOCEAN_ACCESS_TOKEN, DIGITALOCEAN_TOKEN, DO_API_TOKEN, DO_API_KEY, DO_OAUTH_TOKEN and OAUTH_TOKEN |
Examples
- name: Create a reserved IP without assigning it
digitalocean.cloud.reserved_ip_assign:
token: "{{ token }}"
region: nyc3
- name: Create a reserved IP and assign it to a Droplet by ID
digitalocean.cloud.reserved_ip_assign:
token: "{{ token }}"
droplet_id: 3164444
- name: Create a reserved IP and assign it to a Droplet by name and region
digitalocean.cloud.reserved_ip_assign:
token: "{{ token }}"
name: example.com
region: nyc3
- name: Assign an existing reserved IP to a Droplet by ID
digitalocean.cloud.reserved_ip_assign:
token: "{{ token }}"
reserved_ip: "45.55.96.47"
droplet_id: 3164444
- name: Assign an existing reserved IP to a Droplet by name and region
digitalocean.cloud.reserved_ip_assign:
token: "{{ token }}"
reserved_ip: "45.55.96.47"
name: example.com
region: nyc3
- name: Unassign and delete a reserved IP
digitalocean.cloud.reserved_ip_assign:
token: "{{ token }}"
reserved_ip: "45.55.96.47"
state: absentReturn Values
| Key | Returned | Description |
|---|---|---|
actiondict |
when assigning or unassigning an existing reserved IP | DigitalOcean action information. Sample: |
errordict |
failure | DigitalOcean API error. Sample: |
msgstr |
always | Reserved IP operation result information. Sample: |
reserved_ipdict |
always | Reserved IP information. Sample: |