image

Generated on 13 Feb 2026 from digitalocean.cloud version v1.2.1

Synopsis

Create, update, or delete custom images. Custom images allow you to create Droplets from your own disk images or import images from other cloud providers. View the API documentation at https://docs.digitalocean.com/reference/api/api-reference/#tag/Images.

Requirements

  • pydo >= 0.1.3
  • azure-core >= 1.26.1

Parameters

Parameter Choices / Default Description
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.
description
str
An optional description for the image.
distribution
str
The name of the distribution for the image.
id
int
The unique identifier of the image. Used for lookup when updating or deleting.
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.
name
str / required
The display name for the image.
region
str
The slug identifier for the region where the image will be available.
state
str
Choices:
  • present (default)
  • absent
State of the resource, present to create, absent to destroy.
tags
list / elements=str
A list of tags to apply to the image.
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
url
str
The URL from which the custom image will be imported. Required when creating a new image.

Examples

- name: Create custom image from URL
  digitalocean.cloud.image:
    token: "{{ token }}"
    state: present
    name: my-custom-image
    url: https://example.com/my-image.qcow2
    region: nyc3
    distribution: Ubuntu
    description: My custom Ubuntu image

- name: Update image name
  digitalocean.cloud.image:
    token: "{{ token }}"
    state: present
    name: my-renamed-image
    id: 12345678

- name: Delete image
  digitalocean.cloud.image:
    token: "{{ token }}"
    state: absent
    name: my-custom-image
    id: 12345678

Return Values

KeyReturnedDescription
error
dict
failure DigitalOcean API error.
Sample:
{
  "Message": "Informational error message.",
  "Reason": "Unauthorized",
  "Status Code": 401
}
image
dict
always Image information.
Sample:
{
  "created_at": "2020-11-04T22:23:02Z",
  "description": "My custom Ubuntu image",
  "distribution": "Ubuntu",
  "id": 7555620,
  "min_disk_size": 20,
  "name": "my-custom-image",
  "public": false,
  "regions": [
    "nyc3"
  ],
  "size_gigabytes": 2.34,
  "slug": null,
  "status": "available",
  "tags": [],
  "type": "custom"
}
msg
str
always Image result information.
Sample:
[
  "Created image my-custom-image",
  "Updated image my-custom-image",
  "Deleted image my-custom-image",
  "Image my-custom-image would be created",
  "Image my-custom-image exists"
]

We can't find any results for your search.

Try using different keywords or simplifying your search terms.