ali_instance_info – Gather information on instances of Alibaba Cloud ECS¶
New in version 2.8.
Synopsis¶
This module fetches data from the Open API in Alicloud. The module must be called from within the ECS instance itself.
This module was called
ali_instance_facts
before Ansible 2.9. The usage did not change.
Aliases: ali_instance_facts
Requirements¶
The below requirements are needed on the host that executes this module.
footmark >= 1.1.16
python >= 2.6
Parameters¶
Notes¶
Note
If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence
ALICLOUD_ACCESS_KEY
orALICLOUD_ACCESS_KEY_ID
,ALICLOUD_SECRET_KEY
orALICLOUD_SECRET_ACCESS_KEY
,ALICLOUD_REGION
orALICLOUD_REGION_ID
,ALICLOUD_SECURITY_TOKEN
ALICLOUD_REGION
orALICLOUD_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
Examples¶
# Fetch instances details according to setting different filters
- name: fetch instances details example
hosts: localhost
vars:
alicloud_access_key: <your-alicloud-access-key>
alicloud_secret_key: <your-alicloud-secret-key>
alicloud_region: cn-beijing
availability_zone: cn-beijing-a
tasks:
- name: Find all instances in the specified region
ali_instance_info:
alicloud_access_key: '{{ alicloud_access_key }}'
alicloud_secret_key: '{{ alicloud_secret_key }}'
alicloud_region: '{{ alicloud_region }}'
register: all_instances
- name: Find all instances based on the specified ids
ali_instance_info:
alicloud_access_key: '{{ alicloud_access_key }}'
alicloud_secret_key: '{{ alicloud_secret_key }}'
alicloud_region: '{{ alicloud_region }}'
instance_ids:
- "i-35b333d9"
- "i-ddav43kd"
register: instances_by_ids
- name: Find all instances based on the specified names/name-prefixes
ali_instance_info:
alicloud_access_key: '{{ alicloud_access_key }}'
alicloud_secret_key: '{{ alicloud_secret_key }}'
alicloud_region: '{{ alicloud_region }}'
instance_names:
- "ecs_instance-1"
- "ecs_instance_2"
register: instances_by_ids
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Status¶
This module is not guaranteed to have a backwards compatible interface. [preview]
This module is maintained by the Ansible Community. [community]
Authors¶
He Guimin (@xiaozhu36)
Hint
If you notice any issues in this documentation, you can edit this document to improve it.