community / community.digitalocean / 1.3.0 / module / digital_ocean_database Create and delete a DigitalOcean database | "added in version" 1.3.0 of community.digitalocean" Authors: Mark Mercado (@mamercad)community.digitalocean.digital_ocean_database (1.3.0) — module
Install with ansible-galaxy collection install community.digitalocean:==1.3.0
collections: - name: community.digitalocean version: 1.3.0
Create and delete a database in DigitalOcean and optionally wait for it to be online.
DigitalOcean's managed database service simplifies the creation and management of highly available database clusters.
Currently, it offers support for PostgreSQL, Redis, and MySQL.
- name: Create a Redis database community.digitalocean.digital_ocean_database: oauth_token: "{{ lookup('ansible.builtin.env', 'DO_API_KEY') }}" state: present name: testdatabase1 engine: redis size: db-s-1vcpu-1gb region: nyc1 num_nodes: 1 register: my_database
id: aliases: - database_id description: - A unique ID that can be used to identify and reference a database cluster. type: int name: description: - A unique, human-readable name for the database cluster. required: true type: str size: aliases: - size_id description: - The slug identifier representing the size of the nodes in the database cluster. - See U(https://developers.digitalocean.com/documentation/v2/#create-a-new-database-cluster) for supported sizes. required: true type: str tags: description: - An array of tags that have been applied to the database cluster. elements: str type: list wait: default: true description: - Wait for the database to be online before returning. required: false type: bool state: choices: - present - absent default: present description: - Indicates the desired state of the target. type: str engine: choices: - pg - mysql - redis description: - A slug representing the database engine used for the cluster. - The possible values are C(pg) for PostgreSQL, C(mysql) for MySQL, and C(redis) for Redis. required: true type: str region: aliases: - region_id description: - The slug identifier for the region where the database cluster is located. required: true type: str timeout: default: 30 description: - The timeout in seconds used for polling DigitalOcean's API. type: int version: description: - A string representing the version of the database engine in use for the cluster. - For C(pg), versions are 10, 11 and 12. - For C(mysql), version is 8. - For C(redis), version is 5. type: str num_nodes: choices: - 1 - 2 - 3 default: 1 description: - The number of nodes in the database cluster. - Valid choices are 1, 2 or 3. type: int oauth_token: aliases: - api_token description: - DigitalOcean OAuth token. - There are several other environment variables which can be used to provide this value. - i.e., - 'DO_API_TOKEN', 'DO_API_KEY', 'DO_OAUTH_TOKEN' and 'OAUTH_TOKEN' type: str wait_timeout: default: 600 description: - How long before wait gives up, in seconds, when creating a database. type: int 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 private_network_uuid: description: - A string specifying the UUID of the VPC to which the database cluster is assigned. type: str
data: description: A DigitalOcean database returned: success sample: database: connection: database: '' host: testdatabase1-do-user-3097135-0.b.db.ondigitalocean.com password: REDACTED port: 25061 protocol: rediss ssl: true uri: rediss://default:REDACTED@testdatabase1-do-user-3097135-0.b.db.ondigitalocean.com:25061 user: default created_at: '2021-04-21T15:41:14Z' db_names: null engine: redis id: 37de10e4-808b-4f4b-b25f-7b5b3fd194ac maintenance_window: day: monday hour: '11:33:47' pending: false name: testdatabase1 num_nodes: 1 private_connection: database: '' host: private-testdatabase1-do-user-3097135-0.b.db.ondigitalocean.com password: REDIS port: 25061 protocol: rediss ssl: true uri: rediss://default:REDACTED@private-testdatabase1-do-user-3097135-0.b.db.ondigitalocean.com:25061 user: default private_network_uuid: 0db3519b-9efc-414a-8868-8f2e6934688c region: nyc1 size: db-s-1vcpu-1gb status: online tags: null users: null version: '6' type: dict