delowan / delowan.googlecloud / 1.0.2 / module / gcp_storage_bucket Creates a GCP Bucket Authors: Google Inc. (@googlecloudplatform) preview | supported by communitydelowan.googlecloud.gcp_storage_bucket (1.0.2) — module
Install with ansible-galaxy collection install delowan.googlecloud:==1.0.2
collections: - name: delowan.googlecloud version: 1.0.2
The Buckets resource represents a bucket in Google Cloud Storage. There is a single global namespace shared by all buckets. For more information, see Bucket Name Requirements.
Buckets contain objects which can be accessed by their own methods. In addition to the acl property, buckets contain bucketAccessControls, for use in fine-grained manipulation of an existing bucket's access controls.
A bucket is always owned by the project team owners group.
- 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
acl: description: - Access controls on the bucket. elements: dict required: false suboptions: bucket: description: - 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 }}"' required: true type: dict entity: description: - '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 liz@example.com would be user-liz@example.com.' - The group example@googlegroups.com would be group-example@googlegroups.com. - To refer to all members of the Google Apps for Business domain example.com, the entity would be domain-example.com. required: true type: str entity_id: description: - The ID for the entity. required: false type: str project_team: description: - The project team associated with the entity. required: false suboptions: project_number: description: - The project team associated with the entity. required: false type: str team: description: - The team. - 'Some valid choices include: "editors", "owners", "viewers"' required: false type: str type: dict role: description: - The access permission for the entity. - 'Some valid choices include: "OWNER", "READER", "WRITER"' required: false type: str type: list cors: description: - The bucket's Cross-Origin Resource Sharing (CORS) configuration. elements: dict required: false suboptions: max_age_seconds: description: - The value, in seconds, to return in the Access-Control-Max-Age header used in preflight responses. required: false type: int method: description: - '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".' elements: str required: false type: list origin: description: - The list of Origins eligible to receive CORS response headers. - 'Note: "*" is permitted in the list of origins, and means "any Origin".' elements: str required: false type: list response_header: description: - The list of HTTP headers other than the simple response headers to give permission for the user-agent to share across domains. elements: str required: false type: list type: list name: description: - The name of the bucket. required: false type: str owner: description: - The owner of the bucket. This is always the project team's owner group. required: false suboptions: entity: description: - The entity, in the form project-owner-projectId. required: false type: str type: dict state: choices: - present - absent default: present description: - Whether the given object should exist in GCP type: str labels: description: - Labels applied to this bucket. A list of key->value pairs. required: false type: dict scopes: description: - Array of scopes to be used elements: str type: list logging: description: - The bucket's logging configuration, which defines the destination bucket and optional name prefix for the current bucket's logs. required: false suboptions: log_bucket: description: - The destination bucket where the current bucket's logs should be placed. required: false type: str log_object_prefix: description: - A prefix for log object names. required: false type: str type: dict project: description: - The Google Cloud Platform project to use. type: str website: description: - 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. required: false suboptions: main_page_suffix: description: - 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. required: false type: str not_found_page: description: - 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. required: false type: str type: dict env_type: description: - 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. type: str location: description: - 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. required: false type: str auth_kind: choices: - application - machineaccount - serviceaccount description: - The type of credential used. required: true type: str lifecycle: description: - The bucket's lifecycle configuration. - See U(https://developers.google.com/storage/docs/lifecycle) for more information. required: false suboptions: rule: description: - A lifecycle management rule, which is made of an action to take and the condition(s) under which the action will be taken. elements: dict required: false suboptions: action: description: - The action to take. required: false suboptions: storage_class: description: - Target storage class. Required iff the type of the action is SetStorageClass. required: false type: str type: description: - Type of the action. Currently, only Delete and SetStorageClass are supported. - 'Some valid choices include: "Delete", "SetStorageClass"' required: false type: str type: dict condition: description: - The condition(s) under which the action will be taken. required: false suboptions: age_days: description: - Age of an object (in days). This condition is satisfied when an object reaches the specified age. required: false type: int created_before: description: - 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. required: false type: str custom_time_before: description: - A date in the RFC 3339 format YYYY-MM-DD. This condition is satisfied when the customTime metadata for the object is set to an earlier date than the date used in this lifecycle condition. required: false type: str days_since_custom_time: description: - Days since the date set in the customTime metadata for the object. This condition is satisfied when the current date and time is at least the specified number of days after the customTime. required: false type: int days_since_noncurrent_time: description: - Relevant only for versioned objects. This condition is satisfied when an object has been noncurrent for more than the specified number of days. required: false type: int is_live: description: - Relevant only for versioned objects. If the value is true, this condition matches live objects; if the value is false, it matches archived objects. required: false type: bool matches_storage_class: description: - 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. elements: str required: false type: list noncurrent_time_before: description: - Relevant only for versioned objects. A date in the RFC 3339 format YYYY-MM-DD. This condition is satisfied for objects that became noncurrent on a date prior to the one specified in this condition. required: false type: str num_newer_versions: description: - 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. required: false type: int type: dict type: list type: dict versioning: description: - The bucket's versioning configuration. required: false suboptions: enabled: description: - While set to true, versioning is fully enabled for this bucket. required: false type: bool type: dict storage_class: description: - 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"' required: false type: str metageneration: description: - The metadata generation of this bucket. required: false type: int default_object_acl: description: - Default access controls to apply to new objects when no ACL is provided. elements: dict required: false suboptions: bucket: description: - 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 }}"' required: true type: dict entity: description: - 'The entity holding the permission, in one of the following forms: * user-{{userId}} * user-{{email}} (such as "user-liz@example.com") * group-{{groupId}} * group-{{email}} (such as "group-example@googlegroups.com") * domain-{{domain}} (such as "domain-example.com") * project-team-{{projectId}} * allUsers * allAuthenticatedUsers .' required: true type: str object: description: - The name of the object, if applied to an object. required: false type: str role: description: - The access permission for the entity. - 'Some valid choices include: "OWNER", "READER"' required: true type: str type: list service_account_file: description: - The path of a Service Account JSON file if serviceaccount is selected as type. type: path service_account_email: description: - An optional service account email address if machineaccount is selected and the user does not wish to use the default email. type: str default_event_based_hold: description: - Whether or not to automatically apply an eventBasedHold to new objects added to the bucket. required: false type: bool service_account_contents: description: - The contents of a Service Account JSON file, either in a dictionary or as a JSON string that represents it. type: jsonarg predefined_default_object_acl: description: - 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"' required: false type: str
acl: contains: bucket: description: - The name of the bucket. returned: success type: dict domain: description: - The domain associated with the entity. returned: success type: str email: description: - The email address associated with the entity. returned: success type: str entity: description: - '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 liz@example.com would be user-liz@example.com.' - The group example@googlegroups.com would be group-example@googlegroups.com. - To refer to all members of the Google Apps for Business domain example.com, the entity would be domain-example.com. returned: success type: str entityId: description: - The ID for the entity. returned: success type: str id: description: - The ID of the access-control entry. returned: success type: str projectTeam: contains: projectNumber: description: - The project team associated with the entity. returned: success type: str team: description: - The team. returned: success type: str description: - The project team associated with the entity. returned: success type: complex role: description: - The access permission for the entity. returned: success type: str description: - Access controls on the bucket. returned: success type: complex cors: contains: maxAgeSeconds: description: - The value, in seconds, to return in the Access-Control-Max-Age header used in preflight responses. returned: success type: int method: description: - '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".' returned: success type: list origin: description: - The list of Origins eligible to receive CORS response headers. - 'Note: "*" is permitted in the list of origins, and means "any Origin".' returned: success type: list responseHeader: description: - The list of HTTP headers other than the simple response headers to give permission for the user-agent to share across domains. returned: success type: list description: - The bucket's Cross-Origin Resource Sharing (CORS) configuration. returned: success type: complex defaultEventBasedHold: description: - Whether or not to automatically apply an eventBasedHold to new objects added to the bucket. returned: success type: bool defaultObjectAcl: contains: bucket: description: - The name of the bucket. returned: success type: dict domain: description: - The domain associated with the entity. returned: success type: str email: description: - The email address associated with the entity. returned: success type: str entity: description: - 'The entity holding the permission, in one of the following forms: * user-{{userId}} * user-{{email}} (such as "user-liz@example.com") * group-{{groupId}} * group-{{email}} (such as "group-example@googlegroups.com") * domain-{{domain}} (such as "domain-example.com") * project-team-{{projectId}} * allUsers * allAuthenticatedUsers .' returned: success type: str entityId: description: - The ID for the entity. returned: success type: str generation: description: - The content generation of the object, if applied to an object. returned: success type: int id: description: - The ID of the access-control entry. returned: success type: str object: description: - The name of the object, if applied to an object. returned: success type: str projectTeam: contains: projectNumber: description: - The project team associated with the entity. returned: success type: str team: description: - The team. returned: success type: str description: - The project team associated with the entity. returned: success type: complex role: description: - The access permission for the entity. returned: success type: str description: - Default access controls to apply to new objects when no ACL is provided. returned: success type: complex id: description: - The ID of the bucket. For buckets, the id and name properities are the same. returned: success type: str labels: description: - Labels applied to this bucket. A list of key->value pairs. returned: success type: dict lifecycle: contains: rule: contains: action: contains: storageClass: description: - Target storage class. Required iff the type of the action is SetStorageClass. returned: success type: str type: description: - Type of the action. Currently, only Delete and SetStorageClass are supported. returned: success type: str description: - The action to take. returned: success type: complex condition: contains: ageDays: description: - Age of an object (in days). This condition is satisfied when an object reaches the specified age. returned: success type: int createdBefore: description: - 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. returned: success type: str customTimeBefore: description: - A date in the RFC 3339 format YYYY-MM-DD. This condition is satisfied when the customTime metadata for the object is set to an earlier date than the date used in this lifecycle condition. returned: success type: str daysSinceCustomTime: description: - Days since the date set in the customTime metadata for the object. This condition is satisfied when the current date and time is at least the specified number of days after the customTime. returned: success type: int daysSinceNoncurrentTime: description: - Relevant only for versioned objects. This condition is satisfied when an object has been noncurrent for more than the specified number of days. returned: success type: int isLive: description: - Relevant only for versioned objects. If the value is true, this condition matches live objects; if the value is false, it matches archived objects. returned: success type: bool matchesStorageClass: description: - 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. returned: success type: list noncurrentTimeBefore: description: - Relevant only for versioned objects. A date in the RFC 3339 format YYYY-MM-DD. This condition is satisfied for objects that became noncurrent on a date prior to the one specified in this condition. returned: success type: str numNewerVersions: description: - 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. returned: success type: int description: - The condition(s) under which the action will be taken. returned: success type: complex description: - A lifecycle management rule, which is made of an action to take and the condition(s) under which the action will be taken. returned: success type: complex description: - The bucket's lifecycle configuration. - See U(https://developers.google.com/storage/docs/lifecycle) for more information. returned: success type: complex location: description: - 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. returned: success type: str logging: contains: logBucket: description: - The destination bucket where the current bucket's logs should be placed. returned: success type: str logObjectPrefix: description: - A prefix for log object names. returned: success type: str description: - The bucket's logging configuration, which defines the destination bucket and optional name prefix for the current bucket's logs. returned: success type: complex metageneration: description: - The metadata generation of this bucket. returned: success type: int name: description: - The name of the bucket. returned: success type: str owner: contains: entity: description: - The entity, in the form project-owner-projectId. returned: success type: str entityId: description: - The ID for the entity. returned: success type: str description: - The owner of the bucket. This is always the project team's owner group. returned: success type: complex predefinedDefaultObjectAcl: description: - 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.' returned: success type: str project: description: - A valid API project identifier. returned: success type: str projectNumber: description: - The project number of the project the bucket belongs to. returned: success type: str storageClass: description: - 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. returned: success type: str timeCreated: description: - The creation time of the bucket in RFC 3339 format. returned: success type: str updated: description: - The modification time of the bucket in RFC 3339 format. returned: success type: str versioning: contains: enabled: description: - While set to true, versioning is fully enabled for this bucket. returned: success type: bool description: - The bucket's versioning configuration. returned: success type: complex website: contains: mainPageSuffix: description: - 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. returned: success type: str notFoundPage: description: - 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. returned: success type: str description: - 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. returned: success type: complex