Delete a Microsoft Azure Resource Group With Ansible

This Ansible blog post will show you how to delete a Microsoft Azure resource group using an Ansible playbook.

In the previous posts, we learned a lot about Azure and Ansible, and this post will help with cleaning up resources.

The following playbook will delete all the resources in a resource group, including an empty resource group.

Playbook

In the example below, all resources under the resource group WSL will be deleted permanently.

---
- name: Manage Microsft Azure
  hosts: localhost
  connection: local
  gather_facts: no
  tasks:
    - name: Delete a resource group
      azure_rm_resourcegroup:
        name: WSL
        force_delete_nonempty: yes
        state: absent


Posted

in

by