droplet
Generated on 23 May 2025
from digitalocean.cloud
version
v1.2.1
Synopsis
Creates or deletes Droplets. View the create API documentation at https://docs.digitalocean.com/reference/api/api-reference/#operation/droplets_create.
Requirements
- pydo >= 0.1.3
- azure-core >= 1.26.1
Parameters
Parameter | Choices / Default | Description |
---|---|---|
backups bool |
A boolean indicating whether automated backups should be enabled for the Droplet. | |
client_override_options dict |
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_id int |
The Droplet ID which can be used for state=absent when there are more than one Droplet with the same name within the same region |
|
image str |
The image ID of a public or private image or the slug identifier for a public image. This image will be the base image for your Droplet. | |
ipv6 bool |
A boolean indicating whether to enable IPv6 on the Droplet. | |
module_override_options dict |
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. | |
monitoring bool |
A boolean indicating whether to install the DigitalOcean agent for monitoring. | |
name str |
The human-readable string you wish to use when displaying the Droplet name. The name, if set to a domain name managed in the DigitalOcean DNS management system, will configure a PTR record for the Droplet. The name set during creation will also determine the hostname for the Droplet in its internal configuration. | |
region str |
The slug identifier for the region that you wish to deploy the Droplet in. If the specific datacenter is not important, a slug prefix (e.g. nyc ) can be used to deploy the Droplet in any of the that region’s locations (nyc1 , nyc2 , or nyc3). If the region is omitted from the create request completely, the Droplet may deploy in any region. |
|
resize bool |
Resize the Droplet to a larger size if size is larger than the current size. If a permanent resize with disk changes included is desired, set the resize_disk attribute to true . |
|
resize_disk bool |
Resize the Droplet to a larger size if size is larger than the current size. If a permanent resize with disk changes included is desired, set this attribute to true . |
|
size str |
The slug identifier for the size that you wish to select for this Droplet. Required if state=present . If resize is set to true , this will be the new size of the Droplet. If resize_disk is also set to true , this will be the new size of the Droplet disk. |
|
ssh_keys list / elements=str |
An array containing the IDs or fingerprints of the SSH keys that you wish to embed in the Droplet’s root account upon creation. | |
state str |
Choices:
|
State of the resource, present to create, absent to destroy. |
tags list / elements=str |
A flat array of tag names as strings to apply to the Droplet after it is created. Tag names can either be existing or new tags. | |
timeout int |
Default: 300 |
Polling timeout in seconds. |
token str |
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 |
|
unique_name bool |
When true for state=present the Droplet will only be created if it is uniquely named in the region and the region is specified. When true for state=absent the Droplet will only be destroyed if it is uniquely named in the region and the region is specified. |
|
user_data str |
A string containing ‘user data’ which may be used to configure the Droplet on first boot, often a ‘cloud-config’ file or Bash script. It must be plain text and may not exceed 64 KiB in size. | |
volumes list / elements=str |
An array of IDs for block storage volumes that will be attached to the Droplet once created. The volumes must not already be attached to an existing Droplet. | |
vpc_uuid str |
A string specifying the UUID of the VPC to which the Droplet will be assigned. If excluded, the Droplet will be assigned to your account’s default VPC for the region. | |
with_droplet_agent bool |
A boolean indicating whether to install the DigitalOcean agent used for providing access to the Droplet web console in the control panel. By default, the agent is installed on new Droplets but installation errors (i.e. OS not supported) are ignored. To prevent it from being installed, set to false . To make installation errors fatal, explicitly set it to true . |
Examples
- name: Create Droplet
digitalocean.cloud.droplet:
token: "{{ token }}"
state: present
name: example.com
region: nyc3
size: s-1vcpu-1gb
image: ubuntu-20-04-x64
Return Values
Key | Returned | Description |
---|---|---|
droplet dict |
always | Droplet information. Sample:
|
error dict |
failure | DigitalOcean API error. Sample:
|
msg str |
always | Droplet result information. Sample:
|