Note
This plugin is part of the google.cloud collection (version 1.0.2).
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
.
To use it in a playbook, specify: google.cloud.gcp_storage_bucket
.
The below requirements are needed on the host that executes this module.
Parameter | Choices/Defaults | Comments | |||
---|---|---|---|---|---|
acl list / elements=dictionary | Access controls on the bucket. | ||||
bucket dictionary / required | The name of the bucket. This field represents a link to a Bucket resource in GCP. It can be specified in two ways. First, you can place a dictionary with key 'name' and value of your resource's name Alternatively, you can add `register: name-of-resource` to a gcp_storage_bucket task and then set this bucket field to "{{ name-of-resource }}" | ||||
entity string / required | The entity holding the permission, in one of the following forms: user-userId user-email group-groupId group-email domain-domain project-team-projectId allUsers allAuthenticatedUsers Examples: The user [email protected] would be [email protected]. The group [email protected] would be [email protected]. To refer to all members of the Google Apps for Business domain example.com, the entity would be domain-example.com. | ||||
entity_id string | The ID for the entity. | ||||
project_team dictionary | The project team associated with the entity. | ||||
project_number string | The project team associated with the entity. | ||||
team string | The team. Some valid choices include: "editors", "owners", "viewers" | ||||
role string | The access permission for the entity. Some valid choices include: "OWNER", "READER", "WRITER" | ||||
auth_kind string / required |
| The type of credential used. | |||
cors list / elements=dictionary | The bucket's Cross-Origin Resource Sharing (CORS) configuration. | ||||
max_age_seconds integer | The value, in seconds, to return in the Access-Control-Max-Age header used in preflight responses. | ||||
method list / elements=string | The list of HTTP methods on which to include CORS response headers, (GET, OPTIONS, POST, etc) Note: "*" is permitted in the list of methods, and means "any method". | ||||
origin list / elements=string | The list of Origins eligible to receive CORS response headers. Note: "*" is permitted in the list of origins, and means "any Origin". | ||||
response_header list / elements=string | The list of HTTP headers other than the simple response headers to give permission for the user-agent to share across domains. | ||||
default_event_based_hold boolean |
| Whether or not to automatically apply an eventBasedHold to new objects added to the bucket. | |||
default_object_acl list / elements=dictionary | Default access controls to apply to new objects when no ACL is provided. | ||||
bucket dictionary / required | The name of the bucket. This field represents a link to a Bucket resource in GCP. It can be specified in two ways. First, you can place a dictionary with key 'name' and value of your resource's name Alternatively, you can add `register: name-of-resource` to a gcp_storage_bucket task and then set this bucket field to "{{ name-of-resource }}" | ||||
entity string / required | The entity holding the permission, in one of the following forms: * user-{{userId}} * user-{{email}} (such as "[email protected]") * group-{{groupId}} * group-{{email}} (such as "[email protected]") * domain-{{domain}} (such as "domain-example.com") * project-team-{{projectId}} * allUsers * allAuthenticatedUsers . | ||||
object string | The name of the object, if applied to an object. | ||||
role string / required | The access permission for the entity. Some valid choices include: "OWNER", "READER" | ||||
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 | Labels applied to this bucket. A list of key->value pairs. | ||||
lifecycle dictionary | The bucket's lifecycle configuration. See https://developers.google.com/storage/docs/lifecycle for more information. | ||||
rule list / elements=dictionary | A lifecycle management rule, which is made of an action to take and the condition(s) under which the action will be taken. | ||||
action dictionary | The action to take. | ||||
storage_class string | Target storage class. Required iff the type of the action is SetStorageClass. | ||||
type string | Type of the action. Currently, only Delete and SetStorageClass are supported. Some valid choices include: "Delete", "SetStorageClass" | ||||
condition dictionary | The condition(s) under which the action will be taken. | ||||
age_days integer | Age of an object (in days). This condition is satisfied when an object reaches the specified age. | ||||
created_before string | A date in RFC 3339 format with only the date part (for instance, "2013-01-15"). This condition is satisfied when an object is created before midnight of the specified date in UTC. | ||||
is_live boolean |
| Relevant only for versioned objects. If the value is true, this condition matches live objects; if the value is false, it matches archived objects. | |||
matches_storage_class list / elements=string | Objects having any of the storage classes specified by this condition will be matched. Values include MULTI_REGIONAL, REGIONAL, NEARLINE, COLDLINE, ARCHIVE, STANDARD, and DURABLE_REDUCED_AVAILABILITY. | ||||
num_newer_versions integer | Relevant only for versioned objects. If the value is N, this condition is satisfied when there are at least N versions (including the live version) newer than this version of the object. | ||||
location string | The location of the bucket. Object data for objects in the bucket resides in physical storage within this region. Defaults to US. See the developer's guide for the authoritative list. | ||||
logging dictionary | The bucket's logging configuration, which defines the destination bucket and optional name prefix for the current bucket's logs. | ||||
log_bucket string | The destination bucket where the current bucket's logs should be placed. | ||||
log_object_prefix string | A prefix for log object names. | ||||
metageneration integer | The metadata generation of this bucket. | ||||
name string | The name of the bucket. | ||||
owner dictionary | The owner of the bucket. This is always the project team's owner group. | ||||
entity string | The entity, in the form project-owner-projectId. | ||||
predefined_default_object_acl string | Apply a predefined set of default object access controls to this bucket. Acceptable values are: - "authenticatedRead": Object owner gets OWNER access, and allAuthenticatedUsers get READER access. - "bucketOwnerFullControl": Object owner gets OWNER access, and project team owners get OWNER access. - "bucketOwnerRead": Object owner gets OWNER access, and project team owners get READER access. - "private": Object owner gets OWNER access. - "projectPrivate": Object owner gets OWNER access, and project team members get access according to their roles. - "publicRead": Object owner gets OWNER access, and allUsers get READER access. Some valid choices include: "authenticatedRead", "bucketOwnerFullControl", "bucketOwnerRead", "private", "projectPrivate", "publicRead" | ||||
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 given object should exist in GCP | |||
storage_class string | The bucket's default storage class, used whenever no storageClass is specified for a newly-created object. This defines how objects in the bucket are stored and determines the SLA and the cost of storage. Values include MULTI_REGIONAL, REGIONAL, STANDARD, NEARLINE, COLDLINE, ARCHIVE, and DURABLE_REDUCED_AVAILABILITY. If this value is not specified when the bucket is created, it will default to STANDARD. For more information, see storage classes. Some valid choices include: "MULTI_REGIONAL", "REGIONAL", "STANDARD", "NEARLINE", "COLDLINE", "ARCHIVE", "DURABLE_REDUCED_AVAILABILITY" | ||||
versioning dictionary | The bucket's versioning configuration. | ||||
enabled boolean |
| While set to true, versioning is fully enabled for this bucket. | |||
website dictionary | The bucket's website configuration, controlling how the service behaves when accessing bucket contents as a web site. See the Static Website Examples for more information. | ||||
main_page_suffix string | If the requested object path is missing, the service will ensure the path has a trailing '/', append this suffix, and attempt to retrieve the resulting object. This allows the creation of index.html objects to represent directory pages. | ||||
not_found_page string | If the requested object path is missing, and any mainPageSuffix object is missing, if applicable, the service will return the named object from this bucket as the content for a 404 Not Found result. |
- name: create a bucket google.cloud.gcp_storage_bucket: name: ansible-storage-module project: test_project auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" state: present
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description | |||
---|---|---|---|---|---|
acl complex | success | Access controls on the bucket. | |||
bucket dictionary | success | The name of the bucket. | |||
domain string | success | The domain associated with the entity. | |||
email string | success | The email address associated with the entity. | |||
entity string | success | The entity holding the permission, in one of the following forms: user-userId user-email group-groupId group-email domain-domain project-team-projectId allUsers allAuthenticatedUsers Examples: The user [email protected] would be [email protected]. The group [email protected] would be [email protected]. To refer to all members of the Google Apps for Business domain example.com, the entity would be domain-example.com. | |||
entityId string | success | The ID for the entity. | |||
id string | success | The ID of the access-control entry. | |||
projectTeam complex | success | The project team associated with the entity. | |||
projectNumber string | success | The project team associated with the entity. | |||
team string | success | The team. | |||
role string | success | The access permission for the entity. | |||
cors complex | success | The bucket's Cross-Origin Resource Sharing (CORS) configuration. | |||
maxAgeSeconds integer | success | The value, in seconds, to return in the Access-Control-Max-Age header used in preflight responses. | |||
method list / elements=string | success | The list of HTTP methods on which to include CORS response headers, (GET, OPTIONS, POST, etc) Note: "*" is permitted in the list of methods, and means "any method". | |||
origin list / elements=string | success | The list of Origins eligible to receive CORS response headers. Note: "*" is permitted in the list of origins, and means "any Origin". | |||
responseHeader list / elements=string | success | The list of HTTP headers other than the simple response headers to give permission for the user-agent to share across domains. | |||
defaultEventBasedHold boolean | success | Whether or not to automatically apply an eventBasedHold to new objects added to the bucket. | |||
defaultObjectAcl complex | success | Default access controls to apply to new objects when no ACL is provided. | |||
bucket dictionary | success | The name of the bucket. | |||
domain string | success | The domain associated with the entity. | |||
email string | success | The email address associated with the entity. | |||
entity string | success | The entity holding the permission, in one of the following forms: * user-{{userId}} * user-{{email}} (such as "[email protected]") * group-{{groupId}} * group-{{email}} (such as "[email protected]") * domain-{{domain}} (such as "domain-example.com") * project-team-{{projectId}} * allUsers * allAuthenticatedUsers . | |||
entityId string | success | The ID for the entity. | |||
generation integer | success | The content generation of the object, if applied to an object. | |||
id string | success | The ID of the access-control entry. | |||
object string | success | The name of the object, if applied to an object. | |||
projectTeam complex | success | The project team associated with the entity. | |||
projectNumber string | success | The project team associated with the entity. | |||
team string | success | The team. | |||
role string | success | The access permission for the entity. | |||
id string | success | The ID of the bucket. For buckets, the id and name properities are the same. | |||
labels dictionary | success | Labels applied to this bucket. A list of key->value pairs. | |||
lifecycle complex | success | The bucket's lifecycle configuration. See https://developers.google.com/storage/docs/lifecycle for more information. | |||
rule complex | success | A lifecycle management rule, which is made of an action to take and the condition(s) under which the action will be taken. | |||
action complex | success | The action to take. | |||
storageClass string | success | Target storage class. Required iff the type of the action is SetStorageClass. | |||
type string | success | Type of the action. Currently, only Delete and SetStorageClass are supported. | |||
condition complex | success | The condition(s) under which the action will be taken. | |||
ageDays integer | success | Age of an object (in days). This condition is satisfied when an object reaches the specified age. | |||
createdBefore string | success | A date in RFC 3339 format with only the date part (for instance, "2013-01-15"). This condition is satisfied when an object is created before midnight of the specified date in UTC. | |||
isLive boolean | success | Relevant only for versioned objects. If the value is true, this condition matches live objects; if the value is false, it matches archived objects. | |||
matchesStorageClass list / elements=string | success | Objects having any of the storage classes specified by this condition will be matched. Values include MULTI_REGIONAL, REGIONAL, NEARLINE, COLDLINE, ARCHIVE, STANDARD, and DURABLE_REDUCED_AVAILABILITY. | |||
numNewerVersions integer | success | Relevant only for versioned objects. If the value is N, this condition is satisfied when there are at least N versions (including the live version) newer than this version of the object. | |||
location string | success | The location of the bucket. Object data for objects in the bucket resides in physical storage within this region. Defaults to US. See the developer's guide for the authoritative list. | |||
logging complex | success | The bucket's logging configuration, which defines the destination bucket and optional name prefix for the current bucket's logs. | |||
logBucket string | success | The destination bucket where the current bucket's logs should be placed. | |||
logObjectPrefix string | success | A prefix for log object names. | |||
metageneration integer | success | The metadata generation of this bucket. | |||
name string | success | The name of the bucket. | |||
owner complex | success | The owner of the bucket. This is always the project team's owner group. | |||
entity string | success | The entity, in the form project-owner-projectId. | |||
entityId string | success | The ID for the entity. | |||
predefinedDefaultObjectAcl string | success | Apply a predefined set of default object access controls to this bucket. Acceptable values are: - "authenticatedRead": Object owner gets OWNER access, and allAuthenticatedUsers get READER access. - "bucketOwnerFullControl": Object owner gets OWNER access, and project team owners get OWNER access. - "bucketOwnerRead": Object owner gets OWNER access, and project team owners get READER access. - "private": Object owner gets OWNER access. - "projectPrivate": Object owner gets OWNER access, and project team members get access according to their roles. - "publicRead": Object owner gets OWNER access, and allUsers get READER access. | |||
project string | success | A valid API project identifier. | |||
projectNumber string | success | The project number of the project the bucket belongs to. | |||
storageClass string | success | The bucket's default storage class, used whenever no storageClass is specified for a newly-created object. This defines how objects in the bucket are stored and determines the SLA and the cost of storage. Values include MULTI_REGIONAL, REGIONAL, STANDARD, NEARLINE, COLDLINE, ARCHIVE, and DURABLE_REDUCED_AVAILABILITY. If this value is not specified when the bucket is created, it will default to STANDARD. For more information, see storage classes. | |||
timeCreated string | success | The creation time of the bucket in RFC 3339 format. | |||
updated string | success | The modification time of the bucket in RFC 3339 format. | |||
versioning complex | success | The bucket's versioning configuration. | |||
enabled boolean | success | While set to true, versioning is fully enabled for this bucket. | |||
website complex | success | The bucket's website configuration, controlling how the service behaves when accessing bucket contents as a web site. See the Static Website Examples for more information. | |||
mainPageSuffix string | success | If the requested object path is missing, the service will ensure the path has a trailing '/', append this suffix, and attempt to retrieve the resulting object. This allows the creation of index.html objects to represent directory pages. | |||
notFoundPage string | success | If the requested object path is missing, and any mainPageSuffix object is missing, if applicable, the service will return the named object from this bucket as the content for a 404 Not Found result. |
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/google/cloud/gcp_storage_bucket_module.html