1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

support overprovision in azure_rm_vmss (#49806)

This commit is contained in:
Yuwei Zhou 2018-12-14 16:48:40 +08:00 committed by Zim Kalinowski
parent f2eef2d30b
commit 7609a8cdd6
3 changed files with 22 additions and 1 deletions

View file

@ -197,6 +197,12 @@ options:
version_added: "2.7"
aliases:
- security_group_name
overprovision:
description:
- Specifies whether the Virtual Machine Scale Set should be overprovisioned.
type: bool
default: True
version_added: "2.8"
extends_documentation_fragment:
- azure
@ -403,7 +409,8 @@ class AzureRMVirtualMachineScaleSet(AzureRMModuleBase):
virtual_network_name=dict(type='str', aliases=['virtual_network']),
remove_on_absent=dict(type='list', default=['all']),
enable_accelerated_networking=dict(type='bool'),
security_group=dict(type='raw', aliases=['security_group_name'])
security_group=dict(type='raw', aliases=['security_group_name']),
overprovision=dict(type='bool', default=True)
)
self.resource_group = None
@ -432,6 +439,7 @@ class AzureRMVirtualMachineScaleSet(AzureRMModuleBase):
self.load_balancer = None
self.enable_accelerated_networking = None
self.security_group = None
self.overprovision = None
self.results = dict(
changed=False,
@ -570,6 +578,10 @@ class AzureRMVirtualMachineScaleSet(AzureRMModuleBase):
differences.append('Tags')
changed = True
if bool(self.overprovision) != bool(vmss_dict['properties']['overprovision']):
differences.append('overprovision')
changed = True
self.differences = differences
elif self.state == 'absent':
@ -638,6 +650,7 @@ class AzureRMVirtualMachineScaleSet(AzureRMModuleBase):
vmss_resource = self.compute_models.VirtualMachineScaleSet(
location=self.location,
overprovision=self.overprovision,
tags=self.tags,
upgrade_policy=self.compute_models.UpgradePolicy(
mode=self.upgrade_policy
@ -731,6 +744,7 @@ class AzureRMVirtualMachineScaleSet(AzureRMModuleBase):
vmss_resource = self.get_vmss()
vmss_resource.virtual_machine_profile.storage_profile.os_disk.caching = self.os_disk_caching
vmss_resource.sku.capacity = self.capacity
vmss_resource.overprovision = self.overprovision
if self.data_disks is not None:
data_disks = []

View file

@ -182,6 +182,11 @@ vmss:
type: str
returned: always
sample: Linux
overprovision:
description:
- Specifies whether the Virtual Machine Scale Set should be overprovisioned.
type: bool
sample: true
resource_group:
description:
- Resource group.
@ -348,6 +353,7 @@ class AzureRMVirtualMachineScaleSetFacts(AzureRMModuleBase):
'image': vmss['properties']['virtualMachineProfile']['storageProfile']['imageReference'],
'os_disk_caching': vmss['properties']['virtualMachineProfile']['storageProfile']['osDisk']['caching'],
'os_type': 'Linux' if (vmss['properties']['virtualMachineProfile']['osProfile'].get('linuxConfiguration') is not None) else 'Windows',
'overprovision': vmss['properties']['overprovision'],
'managed_disk_type': vmss['properties']['virtualMachineProfile']['storageProfile']['osDisk']['managedDisk']['storageAccountType'],
'data_disks': data_disks,
'virtual_network_name': virtual_network_name,

View file

@ -215,6 +215,7 @@
os_disk_caching: "{{ body.os_disk_caching }}"
image: "{{ body.image }}"
data_disks: "{{ body.data_disks }}"
overprovision: "{{ body.overprovision }}"
register: results
- name: Assert that nothing was changed