Set retentionPolicy for Google cloud storage bucket through ansible Module

Viewed 111

if we want to set the retention value below in ansible module 'gcp_storage_bucket'

gsutil mb -l us-east1 --retention 15d gs://hclsw-gcp-kohl-n-cluster-backups-as

do we have any option for that.. ?

1 Answers

The documentation for gcp_storage_bucket has no mention of retention policy features. The closest functionality available directly is Object Lifecycle Management. You should check out the documentation to confirm whether there’s no available functionality that can fulfill your use case.

Otherwise, object Retention Policies also are exposed through the REST API for Cloud Storage (endpoint):

PATCH https://storage.googleapis.com/storage/v1/b/bucket

There is a built-in Ansible module, which could work with the endpoint above and streamline the creation of retention policies for a given bucket.

Related