Implement a new module to support Batch Account (#55074)

* Implement a new module to support Batch Account.

* Fix the schema definition.

* Fix some lint errors.

* Normalize line endings.

* Remove not-recommended idempotency check.

* adding stubs for discussion

* Add one more output attribute.

* Leverage `idempotency_check` and `normalize_resource_id`.

* Fix line is too long error.

* normalize resource id implementation

* normalizing resource id fix indentation

* Fix linting issues.

* Fix runtime errors of Azure Python SDK.

* Add info module to Batch Account.

* Remove info module per suggestion.

* adding initial comparison function

* fix in idempotency check

* batch account update to support idempotence

* don't modify azure_rm_common for timebeing to avoid excessive ci

* adding first ci

* added more description on comparison function

* fixed storage account name

* fix

* fixed indent in common function + batch account name unpacking

* fix bug

* fixing sanity

* updated class relations

* fix in common

* updated disposition

* Add two more updatable/disposition in module_arg_spec

* updated common file

* Fix documentation for auto_storage_account.

* fixed line too long

* fixed keyvault reference

* fixed batch account creation

* fix pep8

* Regenerate code according to the feedbacks.

* test deleting batch account

* Add auto-generate comments to test file.

* renamed delete task, removed unstable

* clean up storage account
This commit is contained in:
Junyi Yi
2019-06-06 09:10:02 -07:00
committed by Matt Davis
parent a87de8d7b0
commit bd48a7fb73
4 changed files with 417 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
cloud/azure
destructive
shippable/azure/group2

View File

@@ -0,0 +1,2 @@
dependencies:
- setup_azure

View File

@@ -0,0 +1,76 @@
---
# ----------------------------------------------------------------------------
#
# *** 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