New in version 1.5.0.
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 |
OSS bucket name.
aliases: name |
|
| bucket_prefix |
Prefix of OSS bucket name.
|
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 list oss buckets
#
# Basic provisioning example to create bucket
- name: List buckets detail example
hosts: localhost
connection: local
vars:
alicloud_access_key: <your-alicloud-access-key-id>
alicloud_secret_key: <your-alicloud-access-secret-key>
alicloud_region: cn-beijing
bucket: buctest1
bucket_prefix: buctest1
tasks:
- name: List all buckets in the specified region
ali_oss_bucket_facts:
alicloud_access_key: '{{ alicloud_access_key }}'
alicloud_secret_key: '{{ alicloud_secret_key }}'
alicloud_region: '{{ alicloud_region }}'
bucket: '{{ bucket }}'
register: all_buckets
- debug: var=all_buckets
- name: List all buckets in the specified region by name
ali_oss_bucket_facts:
alicloud_access_key: '{{ alicloud_access_key }}'
alicloud_secret_key: '{{ alicloud_secret_key }}'
alicloud_region: '{{ alicloud_region }}'
bucket: '{{ bucket }}'
bucket_prefix: '{{ bucket_prefix }}'
register: buckets_by_name
- debug: var=buckets_by_name
Common return values are documented here, the following are the fields unique to this module:
| Key | Returned | Description |
|---|---|---|
|
bucket_names
list
|
when success |
List all bucket's names in specified region.
Sample:
['xiaozhubucket', 'testbucket']
|
|
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': 'private'}, {'location': 'oss-cn-beijing', 'id': 'testbucket', 'name': 'testbucket', 'permission': 'public-read-write'}]
|
|
total
int
|
when success |
The number of all buckets available in region.
Sample:
2
|
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
Hint
If you notice any issues in this documentation you can edit this document to improve it.