2019-04-24 08:15:13 +02:00
|
|
|
- name: Get resource group facts
|
2019-06-07 07:00:54 +02:00
|
|
|
azure_rm_resourcegroup_info:
|
2019-04-24 08:15:13 +02:00
|
|
|
register: rg
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- rg.resourcegroups | length >= 1
|
|
|
|
|
|
|
|
- name: Get resource group facts
|
2019-06-07 07:00:54 +02:00
|
|
|
azure_rm_resourcegroup_info:
|
2019-04-24 08:15:13 +02:00
|
|
|
name: "{{ resource_group }}"
|
|
|
|
list_resources: yes
|
|
|
|
register: rg
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- rg.resourcegroups | length == 1
|
|
|
|
- rg.resourcegroups[0].resources | length >= 0
|
|
|
|
|
|
|
|
- name: Create resource group (idempontent)
|
|
|
|
azure_rm_resourcegroup:
|
|
|
|
name: "{{ resource_group }}"
|
|
|
|
location: "{{ rg.resourcegroups[0].location }}"
|
|
|
|
register: output
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- not output.changed
|
|
|
|
|
|
|
|
- name: delete resource group
|
|
|
|
azure_rm_resourcegroup:
|
|
|
|
name: "{{ resource_group }}"
|
|
|
|
state: absent
|
|
|
|
check_mode: yes
|
|
|
|
register: output
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- output.changed
|