This topic describes how to use the ali_ros_stack module to delete a stack by writing Ansible playbook code. A VPC is used in the example.

Prerequisites

Ansible is installed on Linux with pip3 and configured.

Procedure

  1. Create a file named delete_vpc.yml and open it in the visual editor.
    vi delete_vpc.yml
  2. In 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