You can use the ali_ros_stack module to delete a stack by writing Ansible playbook code. This topic describes how to use the ali_ros_stack module to delete a stack. VPC deletion is used as an example.

Prerequisites

Ansible is installed and configured on Linux.

Procedure

  1. Create a file named delete_vpc.yml and open it in the visual editor.
    vi delete_vpc.yml
  2. In the edit mode, copy the following playbook code to the delete_vpc.yml file:
    Note For more information about the ali_ros_stack module parameters, see Parameters.
    - hosts: localhost
      remote_user: root
      tasks:
        - name: Changed. Delete Ros Stack
          ali_ros_stack:
            state: absent
            stack_name: vpc_2020-04-08_test
  3. Save the file and exit the edit mode.
  4. Run the Ansible playbook to delete a VPC.
    ansible-playbook delete_vpc.yml -v