Note
This plugin is part of the community.google collection (version 1.0.0).
To install it use: ansible-galaxy collection install community.google.
To use it in a playbook, specify: community.google.gc_storage.
The below requirements are needed on the host that executes this module.
| Parameter | Choices/Defaults | Comments |
|---|---|---|
| bucket string / required | Bucket name. | |
| dest path | The destination file path when downloading an object/key with a GET operation. | |
| expiration integer | Default: 600 | Time limit (in seconds) for the URL generated and returned by GCA when performing a mode=put or mode=get_url operation. This url is only available when public-read is the acl for the object. aliases: expiry |
| gs_access_key string / required | GS access key. If not set then the value of the GS_ACCESS_KEY_ID environment variable is used. | |
| gs_secret_key string / required | GS secret key. If not set then the value of the GS_SECRET_ACCESS_KEY environment variable is used. | |
| headers dictionary | Default: {} | Headers to attach to object. |
| mode string / required |
| Switches the module behaviour between upload, download, get_url (return download url) , get_str (download object as string), create (bucket) and delete (bucket). |
| object path | Keyname of the object inside the bucket. Can be also be used to create "virtual directories" (see examples). | |
| overwrite boolean |
| Forces an overwrite either locally on the filesystem or remotely with the object/key. Used with PUT and GET operations. aliases: force |
| permission string |
| This option let's the user set the canned permissions on the object/bucket that are created. The permissions that can be set are 'private', 'public-read', 'authenticated-read'. |
| region string | Default: "US" | The gs region to use. If not defined then the value 'US' will be used. See https://cloud.google.com/storage/docs/bucket-locations
|
| src string | The source file path when performing a PUT operation. | |
| versioning boolean |
| Whether versioning is enabled or disabled (note that once versioning is enabled, it can only be suspended) |
- name: Upload some content
community.google.gc_storage:
bucket: mybucket
object: key.txt
src: /usr/local/myfile.txt
mode: put
permission: public-read
- name: Upload some headers
community.google.gc_storage:
bucket: mybucket
object: key.txt
src: /usr/local/myfile.txt
headers: '{"Content-Encoding": "gzip"}'
- name: Download some content
community.google.gc_storage:
bucket: mybucket
object: key.txt
dest: /usr/local/myfile.txt
mode: get
- name: Download an object as a string to use else where in your playbook
community.google.gc_storage:
bucket: mybucket
object: key.txt
mode: get_str
- name: Create an empty bucket
community.google.gc_storage:
bucket: mybucket
mode: create
- name: Create a bucket with key as directory
community.google.gc_storage:
bucket: mybucket
object: /my/directory/path
mode: create
- name: Delete a bucket and all contents
community.google.gc_storage:
bucket: mybucket
mode: delete
- name: Create a bucket with versioning enabled
community.google.gc_storage:
bucket: "mybucket"
versioning: yes
mode: create
- name: Create a bucket located in the eu
community.google.gc_storage:
bucket: "mybucket"
region: "europe-west3"
mode: create
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.11/collections/community/google/gc_storage_module.html