You can use Ansible to create, update, query, and delete a stack.
Concepts
Term | Description |
---|---|
Ansible playbook | The configuration, deployment, and orchestration language of Ansible. Playbooks are expressed in YAML format. They can describe a policy you want your remote systems to enforce, or a set of steps in a general IT process. |
Ansible module | The discrete unit of code executed by Ansible. Ansible modules can be used from the command line or in a playbook task. |
Scenario
Resource Orchestration Service (ROS) supports two Ansible modules: ali_ros_stack and ali_ros_stack_info. You can use the two modules in the following scenarios.
Module | Scenario | Reference |
---|---|---|
ali_ros_stack | Create a stack | Use ali_ros_stack to create a stack |
Update a stack | Use ali_ros_stack to update a stack | |
Delete a stack | Use ali_ros_stack to delete a stack | |
ali_ros_stack_info | Query information about a stack | Use ali_ros_stack_info to query information about a stack |
Parameters
ali_ros_stack
- Request parameters
Parameter Type Example Description alicloud_access_key String None The AccessKey ID provided to you by Alibaba Cloud. If this parameter is not specified, the values of the ALICLOUD_ACCESS_KEY and ALICLOUD_ACCESS_KEY_ID environment variables are used. alicloud_region String cn-beijing The ID of the region. If this parameter is not specified, the values of the ALICLOUD_REGION and ALICLOUD_REGION_ID environment variables are used. alicloud_secret_key String None The Alibaba Cloud AccessKey pair. If this parameter is not specified, the values of the ALICLOUD_SECRET_KEY and ALICLOUD_SECRET_ACCESS_KEY environment variables are used. stack_name String vpc_2020-04-08_**** The name of the stack. template_parameters Dict None The parameters of the stack template. state String absent The operation that you want to perform on a stack. Default value: present. Valid values: - present: creates and updates a stack.
- absent: deletes a stack.
template String /tmp/update_vpc.json The file path of the stack template. timeout_in_minutes Integer 60 The timeout period that is specified for the stack creation request. Default value: 60.
Unit: minutes.
-
Response parameters
Parameter Type Example Description stack Dict None The stack information. stack: stack_id String ac3159b9-XXXX-4605-97a5-5fd12792**** The ID of the stack. stack: create_time String 2020-04-27T08:36:43 The time when the stack was created. stack: disable_rollback Boolean false Indicates whether rollback is disabled on stack creation failure. Default value: false. Valid values:
- true: disables rollback on stack creation failure.
- false: enables rollback on stack creation failure.
stack: region_id String cn-beijing The ID of the region to which the stack belongs. stack: stack_name String stack_2020-04-27**** The name of the stack. stack: status String CREATE_IN_PROGRESS The status of the stack. Valid values: - CREATE_IN_PROGRESS: The stack is being created.
- CREATE_FAILED: The stack fails to be created.
- CREATE_COMPLETE: The stack is created.
- UPDATE_IN_PROGRESS: The stack is being updated.
- UPDATE_FAILED: The stack fails to be updated.
- UPDATE_COMPLETE: The stack is updated.
- DELETE_IN_PROGRESS: The stack is being deleted.
- DELETE_FAILED: The stack fails to be deleted.
- DELETE_COMPLETE: The stack is deleted.
- CREATE_ROLLBACK_IN_PROGRESS: The stack creation is being rolled back.
- CREATE_ROLLBACK_FAILED: The stack creation fails to be rolled back.
- CREATE_ROLLBACK_COMPLETE: The stack creation is rolled back.
- ROLLBACK_IN_PROGRESS: The stack is being rolled back.
- ROLLBACK_FAILED: The stack fails to be rolled back.
- ROLLBACK_COMPLETE: The stack is rolled back.
- CHECK_IN_PROGRESS: The stack is being verified.
- CHECK_FAILED: The stack fails to be verified.
- CHECK_COMPLETE: The stack is verified.
- REVIEW_IN_PROGRESS: The stack is being reviewed.
stack: status_reason String Stack CREATE started The reason that the stack is in its current status. stack: timeout_in_minutes Integer 60 The timeout period that is specified for the stack creation request.
Default value: 60.
Unit: minutes.
ali_ros_stack_info
-
Request parameters
Parameter Type Example Description alicloud_access_key String None The AccessKey ID provided to you by Alibaba Cloud. If this parameter is not specified, the values of the ALICLOUD_ACCESS_KEY and ALICLOUD_ACCESS_KEY_ID environment variables are used. alicloud_region String cn-beijing The ID of the region. If this parameter is not specified, the values of the ALICLOUD_REGION and ALICLOUD_REGION_ID environment variables are used. alicloud_secret_key String None The Alibaba Cloud AccessKey pair. If this parameter is not specified, the values of the ALICLOUD_SECRET_KEY and ALICLOUD_SECRET_ACCESS_KEY environment variables are used. stack_ids List ["f83226ec-b0f2-4c78-8139-99fe24f3****","0d87e1b4-c54f-4f3e-abed-2678e661****"] The collection of stack IDs. name_prefix String stack_name The prefix of the stack name. filters Dict None The filtering parameters supported by ROS. Format: {'key': 'value'}
. -
Response parameters
Parameter Type Example Description ids List None The collection of stack IDs. stacks Dict None The collection of stack information. stacks: stack_id String 0f9c682d-xxxx-41cf-838b-308f6fa6**** The ID of the stack. stacks: create_time String 2020-04-27T08:54:32 The time when the stack was created. stacks: disable_rollback Boolean false Indicates whether rollback is disabled on stack creation failure. Default value: false. Valid values:
- true: disables rollback on stack creation failure.
- false: enables rollback on stack creation failure.
stacks: region_id String cn-beijing The ID of the region to which the stack belongs. stacks: stack_name String create_vpc_**** The name of the stack. stacks: status String CREATE_IN_PROGRESS The status of the stack. Valid values:
- CREATE_IN_PROGRESS: The stack is being created.
- CREATE_FAILED: The stack fails to be created.
- CREATE_COMPLETE: The stack is created.
- UPDATE_IN_PROGRESS: The stack is being updated.
- UPDATE_FAILED: The stack fails to be updated.
- UPDATE_COMPLETE: The stack is updated.
- DELETE_IN_PROGRESS: The stack is being deleted.
- DELETE_FAILED: The stack fails to be deleted.
- DELETE_COMPLETE: The stack is deleted.
- CREATE_ROLLBACK_IN_PROGRESS: The stack creation is being rolled back.
- CREATE_ROLLBACK_FAILED: The stack creation fails to be rolled back.
- CREATE_ROLLBACK_COMPLETE: The stack creation is rolled back.
- ROLLBACK_IN_PROGRESS: The stack is being rolled back.
- ROLLBACK_FAILED: The stack fails to be rolled back.
- ROLLBACK_COMPLETE: The stack is rolled back.
- CHECK_IN_PROGRESS: The stack is being verified.
- CHECK_FAILED: The stack fails to be verified.
- CHECK_COMPLETE: The stack is verified.
- REVIEW_IN_PROGRESS: The stack is being reviewed.
stacks: status_reason String Stack CREATE started The reason that the stack is in its current status. stacks: timeout_in_minutes Integer 60 The timeout period that is specified for the stack creation request. Default value: 60.
Unit: minutes.