mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
108 lines
2.8 KiB
YAML
108 lines
2.8 KiB
YAML
|
- name: Prepare random number
|
||
|
set_fact:
|
||
|
dbname: "cosmos{{ resource_group | hash('md5') | truncate(7, True, '') }}{{ 1000 | random }}"
|
||
|
run_once: yes
|
||
|
|
||
|
- name: Create instance of Database Account -- check mode
|
||
|
azure_rm_cosmosdbaccount:
|
||
|
resource_group: "{{ resource_group }}"
|
||
|
name: "{{ dbname }}"
|
||
|
location: eastus
|
||
|
geo_rep_locations:
|
||
|
- name: eastus
|
||
|
failover_priority: 0
|
||
|
database_account_offer_type: Standard
|
||
|
check_mode: yes
|
||
|
register: output
|
||
|
- name: Assert the resource instance is well created
|
||
|
assert:
|
||
|
that:
|
||
|
- output.changed
|
||
|
|
||
|
- name: Create instance of Database Account
|
||
|
azure_rm_cosmosdbaccount:
|
||
|
resource_group: "{{ resource_group }}"
|
||
|
name: "{{ dbname }}"
|
||
|
location: eastus
|
||
|
geo_rep_locations:
|
||
|
- name: eastus
|
||
|
failover_priority: 0
|
||
|
- name: westus
|
||
|
failover_priority: 1
|
||
|
database_account_offer_type: Standard
|
||
|
register: output
|
||
|
- name: Assert the resource instance is well created
|
||
|
assert:
|
||
|
that:
|
||
|
- output.changed
|
||
|
|
||
|
- name: Create again instance of Database Account
|
||
|
azure_rm_cosmosdbaccount:
|
||
|
resource_group: "{{ resource_group }}"
|
||
|
name: "{{ dbname }}"
|
||
|
location: eastus
|
||
|
geo_rep_locations:
|
||
|
- name: eastus
|
||
|
failover_priority: 0
|
||
|
- name: westus
|
||
|
failover_priority: 1
|
||
|
database_account_offer_type: Standard
|
||
|
register: output
|
||
|
- name: Assert the state has not changed
|
||
|
assert:
|
||
|
that:
|
||
|
- output.changed == false
|
||
|
|
||
|
- name: Create again instance of Database Account -- change something
|
||
|
azure_rm_cosmosdbaccount:
|
||
|
resource_group: "{{ resource_group }}"
|
||
|
name: "{{ dbname }}"
|
||
|
location: eastus
|
||
|
geo_rep_locations:
|
||
|
- name: eastus
|
||
|
failover_priority: 0
|
||
|
- name: westus
|
||
|
failover_priority: 1
|
||
|
database_account_offer_type: Standard
|
||
|
enable_automatic_failover: yes
|
||
|
register: output
|
||
|
- name: Assert the state has not changed
|
||
|
assert:
|
||
|
that:
|
||
|
- output.changed
|
||
|
|
||
|
- name: Delete instance of Database Account -- check mode
|
||
|
azure_rm_cosmosdbaccount:
|
||
|
resource_group: "{{ resource_group }}"
|
||
|
name: "{{ dbname }}"
|
||
|
state: absent
|
||
|
check_mode: yes
|
||
|
register: output
|
||
|
- name: Assert the state has changed
|
||
|
assert:
|
||
|
that:
|
||
|
- output.changed
|
||
|
|
||
|
- name: Delete instance of Database Account
|
||
|
azure_rm_cosmosdbaccount:
|
||
|
resource_group: "{{ resource_group }}"
|
||
|
name: "{{ dbname }}"
|
||
|
state: absent
|
||
|
register: output
|
||
|
- name: Assert the state has changed
|
||
|
assert:
|
||
|
that:
|
||
|
- output.changed
|
||
|
|
||
|
# currently disabled as there's a bug in SDK / Service
|
||
|
#- name: Delete unexisting instance of Database Account
|
||
|
# azure_rm_cosmosdbaccount:
|
||
|
# resource_group: "{{ resource_group }}"
|
||
|
# name: "{{ dbname }}"
|
||
|
# state: absent
|
||
|
# register: output
|
||
|
#- name: Assert the state has changed
|
||
|
# assert:
|
||
|
# that:
|
||
|
# - output.changed == false
|