mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fixing upgrade_policy idempotence (#38022)
This commit is contained in:
parent
43ae240431
commit
ee96d42d7d
2 changed files with 39 additions and 0 deletions
|
@ -531,6 +531,13 @@ class AzureRMVirtualMachineScaleSet(AzureRMModuleBase):
|
|||
differences.append('Data Disks')
|
||||
changed = True
|
||||
|
||||
if self.upgrade_policy and \
|
||||
self.upgrade_policy != vmss_dict['properties']['upgradePolicy']['mode']:
|
||||
self.log('CHANGED: virtual machine scale set {0} - Upgrade Policy'.format(self.name))
|
||||
differences.append('Upgrade Policy')
|
||||
changed = True
|
||||
vmss_dict['properties']['upgradePolicy']['mode'] = self.upgrade_policy
|
||||
|
||||
update_tags, vmss_dict['tags'] = self.update_tags(vmss_dict.get('tags', dict()))
|
||||
if update_tags:
|
||||
differences.append('Tags')
|
||||
|
|
|
@ -59,6 +59,38 @@
|
|||
assert:
|
||||
that: results.changed
|
||||
|
||||
- name: Create VMSS -- test upgrade_policy idempotence
|
||||
azure_rm_virtualmachine_scaleset:
|
||||
resource_group: "{{ resource_group }}"
|
||||
name: testVMSS{{ rpfx }}
|
||||
vm_size: Standard_DS1_v2
|
||||
admin_username: testuser
|
||||
ssh_password_enabled: true
|
||||
admin_password: "Password1234!"
|
||||
capacity: 2
|
||||
virtual_network_name: testVnet
|
||||
subnet_name: testSubnet
|
||||
upgrade_policy: Automatic
|
||||
tier: Standard
|
||||
managed_disk_type: Standard_LRS
|
||||
os_disk_caching: ReadWrite
|
||||
image:
|
||||
offer: CoreOS
|
||||
publisher: CoreOS
|
||||
sku: Stable
|
||||
version: latest
|
||||
data_disks:
|
||||
- lun: 0
|
||||
disk_size_gb: 64
|
||||
caching: ReadWrite
|
||||
managed_disk_type: Standard_LRS
|
||||
check_mode: yes
|
||||
register: results
|
||||
|
||||
- name: Assert that VMSS was created
|
||||
assert:
|
||||
that: results.changed
|
||||
|
||||
- name: Retrieve scaleset facts
|
||||
azure_rm_virtualmachine_scaleset_facts:
|
||||
resource_group: "{{ resource_group }}"
|
||||
|
|
Loading…
Reference in a new issue