-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelete_rg.yml
46 lines (41 loc) · 1.19 KB
/
delete_rg.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
---
- hosts: localhost
connection: local
collections:
- azure.azcollection
tasks:
- name: query
azure_rm_resourcegroup_info:
register: output
- debug:
var: output
- name: delete named startwith ansibletest
azure_rm_resourcegroup:
name: "{{ item }}"
state: absent
force: yes
with_items: "{{ output | json_query('resourcegroups[*].name') | select('match', 'ansibletest') | list }}"
async: 10000
poll: 0
register: jobs
#- name: Wait for complete
# async_status: jid={{ item.ansible_job_id }}
# register: job
# until: job.finished
#retries: 300
#with_items: "{{ jobs.results }}"
- name: delete named start with sampletest
azure_rm_resourcegroup:
name: "{{ item }}"
state: absent
force: yes
with_items: "{{ output | json_query('resourcegroups[*].name') | select('match', 'sampletest') | list }}"
async: 10000
poll: 0
register: jobs
#- name: Wait for complete
#async_status: jid={{ item.ansible_job_id }}
#register: job
#until: job.finished
#retries: 300
#with_items: "{{ jobs.results }}"