Using Ansible with OpenStack – Delete our instance

To delete our instance, reuse the os_server command with all authentication information and simply replace ‘ state: present’ by ‘ state: absent’.

$vi stop_compute.yml
- name: launch a compute instance
  hosts: localhost
  gather_facts: False
  tasks:
  - name: Create and launch the VM
    os_server:
      auth:
        auth_url: https://openstack-identity.mygroup/v2.0
        username: "{{ AuthUserName }}"
        password: "{{ AuthPassword }}"
        project_name: "{{ ProjectName }}"
      state: absent
      validate_certs: False
      name: "{{ TPUser }}"
      timeout: 200

if you want to reproduce, please indicate the source:
Using Ansible with OpenStack – Delete our instance - CodeDay