google.cloud.gcp_alloydb_backup module – Creates a GCP Alloydb.Backup resource
Note
This module is part of the google.cloud collection (version 1.13.0).
You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install google.cloud. You need further requirements to be able to use this module, see Requirements for details.
To use it in a playbook, specify: google.cloud.gcp_alloydb_backup.
Synopsis
- An AlloyDB Backup.
Requirements
The below requirements are needed on the host that executes this module.
- python >= 3.8
- requests >= 2.18.4
- google-auth >= 2.25.1
Parameters
Parameter | Comments |
|---|---|
access_token string | The access token used to authenticate. |
annotations dictionary | Annotations to allow client tools to store small amount of arbitrary data. This is distinct from labels. https://google.aip.dev/128 An object containing a list of “key”: value pairs. Example: { “name”: “wrench”, “mass”: “1.3kg”, “count”: “3” }. |
auth_kind string / required | The type of credential used. Choices:
|
backup_id string / required | The ID of the alloydb backup. |
cluster_name string / required | The full resource name of the backup source cluster (e.g., projects/{project}/locations/{location}/clusters/{clusterId}). |
description string | User-provided description of the backup. |
display_name string | User-settable and human-readable display name for the Backup. |
encryption_config dictionary | EncryptionConfig describes the encryption config of a cluster or a backup that is encrypted with a CMEK (customer-managed encryption key). |
|
kms_key_name string |
The fully-qualified resource name of the KMS key. Each Cloud KMS key is regionalized and has the following format: projects/[PROJECT]/locations/[REGION]/keyRings/[RING]/cryptoKeys/[KEY_NAME]. |
env_type string | Specifies which Ansible environment you’re running this module within. This should not be set unless you know what you’re doing. This only alters the User Agent string for any API requests. |
labels dictionary | User-defined labels for the alloydb backup. An object containing a list of “key”: value pairs. Example: { “name”: “wrench”, “mass”: “1.3kg”, “count”: “3” }. |
location string / required | The location where the alloydb backup should reside. |
project string | The Google Cloud Platform project to use. |
scopes list / elements=string | Array of scopes to be used. |
service_account_contents jsonarg | The contents of a Service Account JSON file, either in a dictionary or as a JSON string that represents it. |
service_account_email string | An optional service account email address if machineaccount is selected and the user does not wish to use the default email. |
service_account_file path | The path of a Service Account JSON file if serviceaccount is selected as type. |
state string | Whether the resource should exist in GCP. Choices:
|
type string | The backup type, which suggests the trigger for the backup. Choices:
|
Notes
Note
- API Reference: https://cloud.google.com/alloydb/docs/reference/rest/v1/projects.locations.backups/create
- AlloyDB Guide: https://cloud.google.com/alloydb/docs/
- For authentication, you can set auth_kind using the
GCP_AUTH_KINDenv variable. - For authentication, you can set service_account_file using the
GCP_SERVICE_ACCOUNT_FILEenv variable. - For authentication, you can set service_account_contents using the
GCP_SERVICE_ACCOUNT_CONTENTSenv variable. - For authentication, you can set service_account_email using the
GCP_SERVICE_ACCOUNT_EMAILenv variable. - For authentication, you can set access_token using the
GCP_ACCESS_TOKENenv variable. - For authentication, you can set scopes using the
GCP_SCOPESenv variable. - Environment variables values will only be used if the playbook values are not set.
- The
service_account_email,service_account_file,service_account_fileandaccess_tokenoptions are mutually exclusive.
Examples
- name: Create an on-demand backup for a cluster
google.cloud.gcp_alloydb_backup:
backup_id: my-backup
state: present
cluster_name: projects/my-project/locations/us-central1/clusters/my-cluster
type: ON_DEMAND
location: us-central1
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key | Description |
|---|---|
changed boolean | Whether the resource was changed. Returned: always |
clusterUid string | Output only. The system-generated UID of the cluster which was used to create this resource. Returned: success |
createTime string | Output only. Create time stamp. A timestamp in RFC3339 UTC “Zulu” format, with nanosecond resolution and up to nine fractional digits. Examples: “2014-10-02T15:01:23Z” and “2014-10-02T15:01:23.045123456Z”. Returned: success |
deleteTime string | Output only. Delete time stamp. A timestamp in RFC3339 UTC “Zulu” format, with nanosecond resolution and up to nine fractional digits. Examples: “2014-10-02T15:01:23Z” and “2014-10-02T15:01:23.045123456Z”. Returned: success |
encryptionInfo dictionary | EncryptionInfo describes the encryption information of a cluster or a backup. Returned: success |
|
encryptionType string |
Output only. Type of encryption. Returned: success |
|
kmsKeyVersions list / elements=string |
Output only. Cloud KMS key versions that are being used to protect the database or the backup. Returned: success |
etag string | For Resource freshness validation (https://google.aip.dev/154). Returned: success |
expiryQuantity dictionary | Output only. The QuantityBasedExpiry of the backup, specified by the backup’s retention policy. Once the expiry quantity is over retention, the backup is eligible to be garbage collected. Returned: success |
|
retentionCount integer |
Output only. The backup’s position among its backups with the same source cluster and type, by descending chronological order create time (i.e. newest first). Returned: success |
|
totalRetentionCount integer |
Output only. The length of the quantity-based queue, specified by the backup’s retention policy. Returned: success |
expiryTime string | Output only. The time at which after the backup is eligible to be garbage collected. It is the duration specified by the backup’s retention policy, added to the backup’s createTime. Returned: success |
name string | Output only. The name of the backup resource with the format: * projects/{project}/locations/{region}/backups/{backupId}. Returned: success |
reconciling boolean | Output only. Reconciling (https://google.aip.dev/128#reconciliation), if true, indicates that the service is actively updating the resource. This can happen due to user-triggered updates or system actions like failover or maintenance. Returned: success |
sizeBytes string | Output only. The size of the backup in bytes. Returned: success |
state string | Output only. The current state of the backup. Returned: success |
uid string | Output only. The system-generated UID of the resource. The UID is assigned when the resource is created, and it is retained until it is deleted. Returned: success |
updateTime string | Output only. Update time stamp. A timestamp in RFC3339 UTC “Zulu” format, with nanosecond resolution and up to nine fractional digits. Examples: “2014-10-02T15:01:23Z” and “2014-10-02T15:01:23.045123456Z”. Returned: success |
Collection links
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/projects/ansible/latest/collections/google/cloud/gcp_alloydb_backup_module.html