| Removed in Ansible: | |
|---|---|
| version: 1.5.0 | |
| Why: | Alibaba Cloud module name prefix “ali” will be more concise. |
| Alternative: | Use ali_oss_bucket instead. |
The below requirements are needed on the host that executes this module.
| Parameter | Choices/Defaults | Comments |
|---|---|---|
| alicloud_access_key |
Aliyun Cloud access key. If not set then the value of environment variable
ALICLOUD_ACCESS_KEY, ALICLOUD_ACCESS_KEY_ID will be used instead.aliases: access_key_id, access_key |
|
| alicloud_region |
The Aliyun Cloud region to use. If not specified then the value of environment variable
ALICLOUD_REGION, ALICLOUD_REGION_ID will be used instead.aliases: region, region_id |
|
| alicloud_secret_key |
Aliyun Cloud secret key. If not set then the value of environment variable
ALICLOUD_SECRET_KEY, ALICLOUD_SECRET_ACCESS_KEY will be used instead.aliases: secret_access_key, secret_key |
|
| alicloud_security_token |
The Aliyun Cloud security token. If not specified then the value of environment variable
ALICLOUD_SECURITY_TOKEN will be used instead.aliases: security_token |
|
|
bucket
required |
Bucket name.
aliases: name |
|
| permission |
|
This option lets the user set the canned permissions on the bucket that are created.
aliases: acl |
| state |
|
Create or delete the OSS bucket. List all buckets that has the prefix of 'bucket' value.
|
Note
ALICLOUD_ACCESS_KEY or ALICLOUD_ACCESS_KEY_ID, ALICLOUD_SECRET_KEY or ALICLOUD_SECRET_ACCESS_KEY, ALICLOUD_REGION or ALICLOUD_REGION_ID, ALICLOUD_SECURITY_TOKENALICLOUD_REGION or ALICLOUD_REGION_ID can be typically be used to specify the ALICLOUD region, when required, but this can also be configured in the footmark config file#
# provisioning new oss bucket
#
# basic provisioning example to create bucket
- name: create oss bucket
hosts: localhost
connection: local
vars:
alicloud_access_key: <your-alicloud-access-key-id>
alicloud_secret_key: <your-alicloud-access-secret-key>
alicloud_region: cn-hangzhou
state: present
bucket: bucketname
permission: public-read-write
tasks:
- name: create oss bucket
alicloud_bucket:
alicloud_access_key: '{{ alicloud_access_key }}'
alicloud_secret_key: '{{ alicloud_secret_key }}'
alicloud_region: '{{ alicloud_region }}'
state: '{{ state }}'
bucket: '{{ bucket }}'
permission: '{{ permission }}'
register: result
- debug: var=result
# basic provisioning example to delete bucket
- name: delete oss bucket
hosts: localhost
connection: local
vars:
alicloud_access_key: <your-alicloud-access-key-id>
alicloud_secret_key: <your-alicloud-access-secret-key>
alicloud_region: cn-hangzhou
state: absent
bucket: bucketname
tasks:
- name: delete oss bucket
alicloud_bucket:
alicloud_access_key: '{{ alicloud_access_key }}'
alicloud_secret_key: '{{ alicloud_secret_key }}'
alicloud_region: '{{ alicloud_region }}'
state: '{{ state }}'
bucket: '{{ bucket }}'
register: result
- debug: var=result
Common return values are documented here, the following are the fields unique to this module:
| Key | Returned | Description |
|---|---|---|
|
bucket
dict
|
on present |
the bucket's headers after create bucket or update its acl
Sample:
{'location': 'oss-cn-beijing', 'id': 'xiaozhubucket', 'name': 'xiaozhubucket', 'permission': 'public-read'}
|
|
buckets
list
|
when list |
the list all buckets that has the prefix of 'bucket' value in the specified region
Sample:
[{'location': 'oss-cn-beijing', 'id': 'xiaozhubucket', 'name': 'xiaozhubucket', 'permission': 'public-read'}, {'location': 'oss-cn-beijing', 'id': 'xiaozhubucket-2', 'name': 'xiaozhubucket-2', 'permission': 'private'}]
|
|
changed
bool
|
when success |
current operation whether changed the resource
Sample:
True
|
This module is flagged as deprecated and will be removed in version 1.5.0. For more information see DEPRECATED.
Hint
If you notice any issues in this documentation you can edit this document to improve it.