mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
77 lines
2.2 KiB
YAML
77 lines
2.2 KiB
YAML
---
|
|
# ----------------------------------------------------------------------------
|
|
#
|
|
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
|
#
|
|
# ----------------------------------------------------------------------------
|
|
#
|
|
# This file is automatically generated by Magic Modules and manual
|
|
# changes will be clobbered when the file is regenerated.
|
|
#
|
|
#
|
|
# ----------------------------------------------------------------------------
|
|
- name: Prepare random number
|
|
set_fact:
|
|
storage_account_name: "st{{ resource_group | hash('md5') | truncate(7, True, '') }}{{ 1000 | random }}"
|
|
batch_account_name: "ba{{ resource_group | hash('md5') | truncate(7, True, '') }}{{ 1000 | random }}"
|
|
run_once: yes
|
|
|
|
- name: Create Storage Account
|
|
azure_rm_storageaccount:
|
|
resource_group: "{{ resource_group }}"
|
|
name: "{{ storage_account_name }}"
|
|
location: eastus
|
|
account_type: Standard_LRS
|
|
|
|
- name: Create Batch Account
|
|
azure_rm_batchaccount:
|
|
resource_group: "{{ resource_group }}"
|
|
name: "{{ batch_account_name }}"
|
|
location: eastus
|
|
auto_storage_account:
|
|
name: "{{ storage_account_name }}"
|
|
pool_allocation_mode: batch_service
|
|
register: output
|
|
|
|
- name: Assert the resource was created
|
|
assert:
|
|
that:
|
|
- output.changed
|
|
|
|
- name: Create Batch Account -- idempotent
|
|
azure_rm_batchaccount:
|
|
resource_group: "{{ resource_group }}"
|
|
name: "{{ batch_account_name }}"
|
|
location: eastus
|
|
auto_storage_account:
|
|
name: "{{ storage_account_name }}"
|
|
pool_allocation_mode: batch_service
|
|
register: output
|
|
|
|
- name: Assert the resource was created
|
|
assert:
|
|
that:
|
|
- not output.changed
|
|
|
|
- name: Delete Batch Account
|
|
azure_rm_batchaccount:
|
|
resource_group: "{{ resource_group }}"
|
|
name: "{{ batch_account_name }}"
|
|
location: eastus
|
|
auto_storage_account:
|
|
name: "{{ storage_account_name }}"
|
|
pool_allocation_mode: batch_service
|
|
state: absent
|
|
register: output
|
|
|
|
- name: Assert that state has changed
|
|
assert:
|
|
that:
|
|
- output.changed
|
|
|
|
- name: Clean up storage account
|
|
azure_rm_storageaccount:
|
|
resource_group: "{{ resource_group }}"
|
|
name: "{{ storage_account_name }}"
|
|
state: absent
|