- name:Create VMSS with security group in different resource group(check mode).
azure_rm_virtualmachine_scaleset:
resource_group:"{{ resource_group }}"
name:testVMSS{{ rpfx }}3
vm_size:Standard_DS1_v2
capacity:1
virtual_network_name:testVnet
subnet_name:testSubnet
admin_username:testuser
ssh_password_enabled:true
admin_password:"Password1234!"
image:
offer:CoreOS
publisher:CoreOS
sku:Stable
version:latest
upgrade_policy:Manual
security_group:
name:testNetworkSecurityGroup2
resource_group:"{{ resource_group_secondary }}"
register:results
check_mode:yes
- name:Assert that VMSS ran
assert:
that:results.changed
- name:Create VMSS with security group in different resource group.
azure_rm_virtualmachine_scaleset:
resource_group:"{{ resource_group }}"
name:testVMSS{{ rpfx }}3
vm_size:Standard_DS1_v2
capacity:1
virtual_network_name:testVnet
subnet_name:testSubnet
admin_username:testuser
ssh_password_enabled:true
admin_password:"Password1234!"
image:
offer:CoreOS
publisher:CoreOS
sku:Stable
version:latest
upgrade_policy:Manual
security_group:
name:testNetworkSecurityGroup2
resource_group:"{{ resource_group_secondary }}"
register:results
- name:Assert that VMSS ran
assert:
that:
- 'results.changed'
- '"testNetworkSecurityGroup2" in results.ansible_facts.azure_vmss.properties.virtualMachineProfile.networkProfile.networkInterfaceConfigurations.0.properties.networkSecurityGroup.id'
- name:Delete VMSS
azure_rm_virtualmachine_scaleset:
resource_group:"{{ resource_group }}"
name:testVMSS{{ rpfx }}3
state:absent
remove_on_absent:['all']
vm_size:Standard_DS1_v2
capacity:1
image:
offer:CoreOS
publisher:CoreOS
sku:Stable
version:latest
- name:Fail when instance type is not supported to enable accelerated networking
azure_rm_virtualmachine_scaleset:
resource_group:"{{ resource_group }}"
name:testVMSS{{ rpfx }}4
vm_size:Standard_DS1_v2
virtual_network_name:testVnet
subnet_name:testSubnet
admin_username:testuser
ssh_password_enabled:true
admin_password:"Password1234!"
image:
offer:CoreOS
publisher:CoreOS
sku:Stable
version:latest
upgrade_policy:Manual
enable_accelerated_networking:yes
register:results
ignore_errors:yes
- name:Assert failure to show that accelerated networking is enabled only with supported instance types.
assert:
that:
- '"VMSizeIsNotPermittedToEnableAcceleratedNetworkingForVmss" in results.msg'
- name:Delete network security group
azure_rm_securitygroup:
resource_group:"{{ resource_group }}"
name:testNetworkSecurityGroup
state:absent
- name:Delete network security group
azure_rm_securitygroup:
resource_group:"{{ resource_group_secondary }}"
name:testNetworkSecurityGroup2
state:absent
- name:Delete load balancer
azure_rm_loadbalancer:
@ -302,4 +464,4 @@
image:
name:invalid-image
register:fail_missing_custom_image_dict
failed_when:fail_missing_custom_image_dict.msg != "Error could not find image with name invalid-image"
failed_when:fail_missing_custom_image_dict.msg != "Error could not find image with name invalid-image"