2017-08-17 21:20:16 +00:00
|
|
|
- name: Create an availability set with default options
|
|
|
|
azure_rm_availabilityset:
|
|
|
|
name: myavailabilityset1
|
|
|
|
resource_group: "{{ resource_group }}"
|
|
|
|
tags:
|
|
|
|
tag1: testtag
|
2017-08-17 23:04:33 +00:00
|
|
|
register: results
|
2017-08-17 21:20:16 +00:00
|
|
|
|
|
|
|
- assert:
|
2017-08-17 23:04:33 +00:00
|
|
|
that: results.changed
|
2017-08-17 21:20:16 +00:00
|
|
|
|
|
|
|
- name: Create an availability set with advanced options
|
|
|
|
azure_rm_availabilityset:
|
|
|
|
name: myavailabilityset2
|
|
|
|
resource_group: "{{ resource_group }}"
|
|
|
|
platform_update_domain_count: 5
|
|
|
|
platform_fault_domain_count: 2
|
|
|
|
sku: Aligned
|
2017-08-17 23:04:33 +00:00
|
|
|
register: results
|
2017-08-17 21:20:16 +00:00
|
|
|
|
|
|
|
- assert:
|
2017-08-17 23:04:33 +00:00
|
|
|
that: results.changed
|
2017-08-17 21:20:16 +00:00
|
|
|
|
2017-08-30 00:39:37 +00:00
|
|
|
- name: Modify availabilty set immutable options - no changes, fail for immutable options
|
2017-08-17 21:20:16 +00:00
|
|
|
azure_rm_availabilityset:
|
|
|
|
name: myavailabilityset2
|
|
|
|
resource_group: "{{ resource_group }}"
|
|
|
|
platform_update_domain_count: 2
|
|
|
|
platform_fault_domain_count: 2
|
|
|
|
sku: Aligned
|
2017-08-17 23:04:33 +00:00
|
|
|
register: results
|
2017-08-30 00:39:37 +00:00
|
|
|
ignore_errors: yes
|
2017-08-17 21:20:16 +00:00
|
|
|
|
|
|
|
- assert:
|
2017-08-17 23:04:33 +00:00
|
|
|
that:
|
|
|
|
- not results.changed
|
2017-08-30 00:39:37 +00:00
|
|
|
- results.msg == 'You tried to change platform_update_domain_count but is was unsuccessful. An Availability Set is immutable, except tags'
|
2017-08-17 23:04:33 +00:00
|
|
|
|
2017-08-30 00:39:37 +00:00
|
|
|
- name: Modify availabilty set immutable options and set tags - change tags and fail for immutable options
|
2017-08-17 23:04:33 +00:00
|
|
|
azure_rm_availabilityset:
|
|
|
|
name: myavailabilityset2
|
|
|
|
resource_group: "{{ resource_group }}"
|
|
|
|
platform_update_domain_count: 2
|
|
|
|
platform_fault_domain_count: 2
|
|
|
|
sku: Aligned
|
|
|
|
tags:
|
|
|
|
test1: modified
|
|
|
|
register: results
|
2017-08-30 00:39:37 +00:00
|
|
|
ignore_errors: yes
|
2017-08-17 23:04:33 +00:00
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
2017-08-30 00:39:37 +00:00
|
|
|
- not results.changed
|
|
|
|
- results.msg == 'You tried to change platform_update_domain_count but is was unsuccessful. An Availability Set is immutable, except tags'
|
2017-08-17 21:20:16 +00:00
|
|
|
|
|
|
|
- name: Modify availabilty set options to update tags
|
|
|
|
azure_rm_availabilityset:
|
|
|
|
name: myavailabilityset2
|
|
|
|
resource_group: "{{ resource_group }}"
|
|
|
|
platform_update_domain_count: 5
|
|
|
|
platform_fault_domain_count: 2
|
|
|
|
sku: Aligned
|
|
|
|
tags:
|
2017-08-17 23:04:33 +00:00
|
|
|
test2: modified
|
|
|
|
register: results
|
2017-08-17 21:20:16 +00:00
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
2017-08-17 23:04:33 +00:00
|
|
|
- results.state.tags.test2 == 'modified'
|
2017-08-17 21:20:16 +00:00
|
|
|
|
|
|
|
- name: Create availability set with incorrect fault domain parameter
|
|
|
|
azure_rm_availabilityset:
|
|
|
|
name: myavailabilityset3
|
|
|
|
resource_group: "{{ resource_group }}"
|
|
|
|
platform_update_domain_count: 5
|
|
|
|
platform_fault_domain_count: 4
|
|
|
|
sku: Aligned
|
2017-08-17 23:04:33 +00:00
|
|
|
register: results
|
2017-08-17 21:20:16 +00:00
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- assert:
|
2017-08-17 23:04:33 +00:00
|
|
|
{ that: "'The specified fault domain count 4 must fall in the range 1 to' in results['msg']" }
|
|
|
|
|
|
|
|
- name: Test check_mode
|
|
|
|
azure_rm_availabilityset:
|
|
|
|
name: myavailabilityset2
|
|
|
|
resource_group: "{{ resource_group }}"
|
|
|
|
platform_update_domain_count: 5
|
|
|
|
platform_fault_domain_count: 2
|
|
|
|
sku: Aligned
|
|
|
|
tags:
|
|
|
|
checktest1: modified1
|
|
|
|
checktest2: modified2
|
|
|
|
check_mode: yes
|
|
|
|
register: results
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- not results.changed
|
|
|
|
- results.state.tags.checktest1 == 'modified1'
|
2017-08-17 21:20:16 +00:00
|
|
|
|
|
|
|
- name: Delete an availability set
|
|
|
|
azure_rm_availabilityset:
|
|
|
|
name: myavailabilityset1
|
|
|
|
resource_group: "{{ resource_group }}"
|
|
|
|
state: absent
|
|
|
|
|
|
|
|
- name: Delete an availability set
|
|
|
|
azure_rm_availabilityset:
|
|
|
|
name: myavailabilityset2
|
|
|
|
resource_group: "{{ resource_group }}"
|
|
|
|
state: absent
|
|
|
|
|
|
|
|
- name: Delete an availability set
|
|
|
|
azure_rm_availabilityset:
|
|
|
|
name: myavailabilityset3
|
|
|
|
resource_group: "{{ resource_group }}"
|
|
|
|
state: absent
|