Create or delete database clusters.
DigitalOcean’s managed database service simplifies the creation and management of highly javailable database clusters.
Currently, it offers support for PostgreSQL, Redis, MySQL, and MongoDB.
Database clusters may be deployed in a multi-node, high-availability configuration.
If your machine type is above the basic nodes, your node plan is above the smallest option, or you are running MongoDB, you may additionally include up to two standby nodes in your cluster.
The size of individual nodes in a database cluster is represented by a human-readable slug, which is used in some of the following requests.
Each slug denotes the node’s identifier, CPU count, and amount of RAM, in that order.
View the create API documentation at https://docs.digitalocean.com/reference/api/api-reference/#tag/Databases.
Parameter | Choices | Default | Comments |
---|---|---|---|
backup_restore (dict) |
Object (database_backup) | ||
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. | ||
engine (str) |
|
A slug representing the database engine used for the cluster. The possible values are "pg" for PostgreSQL, "mysql" for MySQL, "redis" for Redis, and "mongodb" for MongoDB. | |
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) |
A unique, human-readable name referring to a database cluster. | ||
num_nodes (int) |
1 | The number of nodes in the database cluster. | |
private_network_uuid (str) |
A string specifying the UUID of the VPC to which the database cluster will be assigned. If excluded, the cluster when creating a new database cluster, it will be assigned to your account's default VPC for the region. | ||
project_id (str) |
The ID of the project that the database cluster is assigned to. If excluded when creating a new database cluster, it will be assigned to your default project. | ||
region (str) |
The slug identifier for the region where the database cluster is located. | ||
rules (list) |
Array of objects (firewall_rule) | ||
size (str) |
db-s-1vcpu-1gb | The slug identifier representing the size of the nodes in the database cluster. | |
state (str) |
|
present | State of the resource, present to create, absent to destroy. |
tags (list) |
An array of tags that have been applied to the database cluster. | ||
timeout (int) |
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 |
||
version (str) |
A string representing the version of the database engine in use for the cluster. |
- name: Create Postgres database cluster
digitalocean.cloud.database_cluster:
token: "{{ token }}"
state: present
name: backend
region: nyc3
type: pg
num_nodes: 2
size: db-s-2vcpu-4gb
Key | Returned | Description |
---|---|---|
database (dict) |
always |
Database information.
Sample:
|
error (dict) |
failure |
DigitalOcean API error.
Sample:
|
msg (str) |
always |
Droplet result information.
Sample:
|