[new module] azure_rm_keyvault (#35150)

* updates to azure_rm_keyvault

* updates to azure_rm_keyvault

* updates to azure_rm_keyvault

* updates to azure_rm_keyvault

* updates to azure_rm_keyvault

* updates to azure_rm_keyvault

* updates to azure_rm_keyvault

* updates to azure_rm_keyvault

* updates to azure_rm_keyvault

* updates to azure_rm_keyvault

* updates to azure_rm_keyvault

* updates to azure_rm_keyvault

* updates to azure_rm_keyvault

* fix update bugs, add update test
This commit is contained in:
Zim Kalinowski 2018-02-06 08:08:22 +08:00 committed by Matt Davis
commit 86c62e228d
4 changed files with 621 additions and 0 deletions

View file

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

View file

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

View file

@ -0,0 +1,123 @@
- name: Prepare random number
set_fact:
rpfx: "{{ resource_group | hash('md5') | truncate(7, True, '') }}{{ 1000 | random }}"
run_once: yes
- name: Create instance of Key Vault -- check mode
azure_rm_keyvault:
resource_group: "{{ resource_group }}"
vault_name: "vault{{ rpfx }}"
vault_tenant: 11111111-1111-1111-1111-111122223333
enabled_for_deployment: yes
sku:
name: standard
family: A
access_policies:
- object_id: 99998888-8666-4144-9199-2d7cd0111111
keys:
- get
- list
check_mode: yes
register: output
- name: Assert the resource instance is well created
assert:
that:
- output.changed
- name: Create instance of Key Vault
azure_rm_keyvault:
resource_group: "{{ resource_group }}"
vault_name: "vault{{ rpfx }}"
vault_tenant: 11111111-1111-1111-1111-111122223333
enabled_for_deployment: yes
sku:
name: standard
family: A
access_policies:
- object_id: 99998888-8666-4144-9199-2d7cd0111111
keys:
- get
- list
register: output
- name: Assert the resource instance is well created
assert:
that:
- output.changed
- name: Create again instance of Key Vault
azure_rm_keyvault:
resource_group: "{{ resource_group }}"
vault_name: "vault{{ rpfx }}"
vault_tenant: 11111111-1111-1111-1111-111122223333
enabled_for_deployment: yes
sku:
name: standard
family: A
access_policies:
- object_id: 99998888-8666-4144-9199-2d7cd0111111
keys:
- get
- list
register: output
- name: Assert the state has not changed
assert:
that:
- output.changed == false
- name: Update existing Key Vault (add a rule)
azure_rm_keyvault:
resource_group: "{{ resource_group }}"
vault_name: "vault{{ rpfx }}"
vault_tenant: 11111111-1111-1111-1111-111122223333
enabled_for_deployment: yes
sku:
name: standard
family: A
access_policies:
- object_id: 99998888-8666-4144-9199-2d7cd0111111
certificates:
- get
- list
- object_id: 11112222-8666-4144-9199-2d7cd0111111
keys:
- get
- list
register: output
- name: Assert the state has changed
assert:
that:
- output.changed == true
- name: Delete instance of Key Vault -- check mode
azure_rm_keyvault:
resource_group: "{{ resource_group }}"
vault_name: "vault{{ rpfx }}"
state: absent
check_mode: yes
register: output
- name: Assert the state has changed
assert:
that:
- output.changed
- name: Delete instance of Key Vault
azure_rm_keyvault:
resource_group: "{{ resource_group }}"
vault_name: "vault{{ rpfx }}"
state: absent
register: output
- name: Assert the state has changed
assert:
that:
- output.changed
- name: Delete unexisting instance of Key Vault
azure_rm_keyvault:
resource_group: "{{ resource_group }}"
vault_name: "vault{{ rpfx }}"
state: absent
register: output
- name: Assert the state has changed
assert:
that:
- output.changed == false