Write an Ansible playbook that uses the ali_ros_stack_info module to query stacks. This example shows how to query a stack that contains a virtual private cloud (VPC).
Prerequisites
Install and configure the Ansible module on a Linux system using pip3. For more information, see Install and configure Ansible.
Procedure
- Create a file named get_vpc.yml and open it in the VI editor.
vi get_vpc.yml - In edit mode, paste the following sample code into the get_vpc.yml
Note For more information about the parameters of the ali_ros_stack_info module, see Parameter descriptions.
- hosts: localhost remote_user: root tasks: - name: Get ROS Stack Info By ids ali_ros_stack_info: stack_ids: - f83226ec-b0f2-4c78-8139-99fe24f3**** - 0d87e1b4-c54f-4f3e-abed-2678e661**** - name: Get ROS Stack Info By name_prefix ali_ros_stack_info: name_prefix: kong_stack - Save the file and exit edit mode.
- Run the Ansible playbook to query information about the VPC-connected instance.
ansible-playbook get_vpc.yml -v
该文章对您有帮助吗?