You can write an Ansible playbook that uses the ali_ros_stack module to automatically delete a stack. This example demonstrates how to delete a virtual private cloud (VPC).
Prerequisites
The Ansible module is installed and configured on Linux using pip3.
Procedure
- Create a file named delete_vpc.yml and open it in the VI editor.
vi delete_vpc.yml - In edit mode, paste the following sample playbook into the delete_vpc.yml
Note For more information about the parameters of the ali_ros_stack module, see Parameter description.
- hosts: localhost remote_user: root tasks: - name: Changed. Delete the ROS stack ali_ros_stack: state: absent stack_name: vpc_2020-04-08_test - Save the file and exit edit mode.
- Run the Ansible playbook to delete the VPC-connected instance.
ansible-playbook delete_vpc.yml -v