ansible / ansible.builtin / v2.7.16 / module / azure_rm_virtualmachine_scaleset Manage Azure virtual machine scale sets. | "added in version" 2.4 of ansible.builtin" Authors: Sertac Ozercan (@sozercan) preview | supported by communityansible.builtin.azure_rm_virtualmachine_scaleset (v2.7.16) — module
pip
Install with pip install ansible==2.7.16
Create and update a virtual machine scale set.
- name: Create VMSS azure_rm_virtualmachine_scaleset: resource_group: Testing name: testvmss vm_size: Standard_DS1_v2 capacity: 2 virtual_network_name: testvnet subnet_name: testsubnet admin_username: adminUser ssh_password_enabled: false ssh_public_keys: - path: /home/adminUser/.ssh/authorized_keys key_data: < insert yor ssh public key here... > managed_disk_type: Standard_LRS image: offer: CoreOS publisher: CoreOS sku: Stable version: latest data_disks: - lun: 0 disk_size_gb: 64 caching: ReadWrite managed_disk_type: Standard_LRS
- name: Create a VMSS with a custom image azure_rm_virtualmachine_scaleset: resource_group: Testing name: testvmss vm_size: Standard_DS1_v2 capacity: 2 virtual_network_name: testvnet subnet_name: testsubnet admin_username: adminUser admin_password: password01 managed_disk_type: Standard_LRS image: customimage001
- name: Create a VMSS with a custom image from a particular resource group azure_rm_virtualmachine_scaleset: resource_group: Testing name: testvmss vm_size: Standard_DS1_v2 capacity: 2 virtual_network_name: testvnet subnet_name: testsubnet admin_username: adminUser admin_password: password01 managed_disk_type: Standard_LRS image: name: customimage001 resource_group: Testing
name: description: - Name of the virtual machine. required: true tags: description: - Dictionary of string:string pairs to assign as metadata to the object. - Metadata tags on the object will be updated with any provided values. - To remove tags set append_tags option to false. - Currently, Azure DNS zones and Traffic Manager services also don't allow the use of spaces in the tag. - Azure Front Door doesn't support the use of - Azure Automation and Azure CDN only support 15 tags on resources. type: dict tier: choices: - Basic - Standard description: - SKU Tier. image: description: - Specifies the image used to build the VM. - If a string, the image is sourced from a custom image based on the name. - 'If a dict with the keys C(publisher), C(offer), C(sku), and C(version), the image is sourced from a Marketplace image. NOTE: set image.version to C(latest) to get the most recent version of a given image.' - 'If a dict with the keys C(name) and C(resource_group), the image is sourced from a custom image based on the C(name) and C(resource_group) set. NOTE: the key C(resource_group) is optional and if omitted, all images in the subscription will be searched for by C(name).' - Custom image support was added in Ansible 2.5 required: true state: choices: - absent - present default: present description: - Assert the state of the virtual machine scale set. - State 'present' will check that the machine exists with the requested configuration. If the configuration of the existing machine does not match, the machine will be updated. state. - State 'absent' will remove the virtual machine scale set. secret: description: - Azure client secret. Use when authenticating with a Service Principal. type: str tenant: description: - Azure tenant ID. Use when authenticating with a Service Principal. type: str ad_user: description: - Active Directory username. Use when authenticating with an Active Directory user rather than service principal. type: str os_type: choices: - Windows - Linux default: Linux description: - Base type of operating system. profile: description: - Security profile found in ~/.azure/credentials file. type: str vm_size: description: - A valid Azure VM size value. For example, 'Standard_D4'. The list of choices varies depending on the subscription and location. Check your subscription for available choices. required: true capacity: default: 1 description: - Capacity of VMSS. required: true location: description: - Valid Azure location. Defaults to location of the resource group. log_mode: description: - Parent argument. type: str log_path: description: - Parent argument. type: str password: description: - Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. type: str client_id: description: - Azure client ID. Use when authenticating with a Service Principal. type: str data_disks: description: - Describes list of data disks. suboptions: caching: choices: - ReadOnly - ReadWrite default: ReadOnly description: - Type of data disk caching. version_added: '2.4' version_added_collection: ansible.builtin disk_size_gb: description: - The initial disk size in GB for blank data disks. version_added: '2.4' version_added_collection: ansible.builtin lun: default: 0 description: - The logical unit number for data disk. version_added: '2.4' version_added_collection: ansible.builtin managed_disk_type: choices: - Standard_LRS - Premium_LRS description: - Managed data disk type. version_added: '2.4' version_added_collection: ansible.builtin version_added: '2.4' version_added_collection: ansible.builtin thumbprint: description: - The thumbprint of the private key specified in I(x509_certificate_path). - Use when authenticating with a Service Principal. - Required if I(x509_certificate_path) is defined. type: str version_added: 1.14.0 version_added_collection: azure.azcollection api_profile: default: latest description: - Selects an API profile to use when communicating with Azure services. Default value of C(latest) is appropriate for public clouds; future values will allow use with Azure Stack. type: str version_added: 0.0.1 version_added_collection: azure.azcollection append_tags: default: true description: - Use to control if tags field is canonical or just appends to existing tags. - When canonical, any tags not found in the tags parameter will be removed from the object's metadata. type: bool auth_source: choices: - auto - cli - credential_file - env - msi default: auto description: - Controls the source of the credentials to use for authentication. - Can also be set via the C(ANSIBLE_AZURE_AUTH_SOURCE) environment variable. - When set to C(auto) (the default) the precedence is module parameters -> C(env) -> C(credential_file) -> C(cli). - When set to C(env), the credentials will be read from the environment variables - When set to C(credential_file), it will read the profile from C(~/.azure/credentials). - When set to C(cli), the credentials will be sources from the Azure CLI profile. C(subscription_id) or the environment variable C(AZURE_SUBSCRIPTION_ID) can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. - When set to C(msi), the host machine must be an azure resource with an enabled MSI extension. C(subscription_id) or the environment variable C(AZURE_SUBSCRIPTION_ID) can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. - The C(msi) was added in Ansible 2.6. type: str version_added: 0.0.1 version_added_collection: azure.azcollection subnet_name: aliases: - subnet description: - Subnet name. load_balancer: description: - Load balancer name. version_added: '2.5' version_added_collection: ansible.builtin admin_password: description: - Password for the admin username. Not required if the os_type is Linux and SSH password authentication is disabled by setting ssh_password_enabled to false. admin_username: description: - Admin username used to access the host after it is created. Required when creating a VM. resource_group: description: - Name of the resource group containing the virtual machine scale set. required: true security_group: aliases: - security_group_name description: - Existing security group with which to associate the subnet. - It can be the security group name which is in the same resource group. - It can be the resource Id. - It can be a dict which contains C(name) and C(resource_group) of the security group. version_added: '2.7' version_added_collection: ansible.builtin short_hostname: description: - Short host name upgrade_policy: choices: - Manual - Automatic description: - Upgrade policy. os_disk_caching: aliases: - disk_caching choices: - ReadOnly - ReadWrite default: ReadOnly description: - Type of OS disk caching. ssh_public_keys: description: - 'For os_type Linux provide a list of SSH keys. Each item in the list should be a dictionary where the dictionary contains two keys: path and key_data. Set the path to the default location of the authorized_keys files. On an Enterprise Linux host, for example, the path will be /home/<admin username>/.ssh/authorized_keys. Set key_data to the actual value of the public key.' subscription_id: description: - Your Azure subscription Id. type: str remove_on_absent: default: - all description: - When removing a VM using state 'absent', also remove associated resources. - 'It can be ''all'' or a list with any of the following: [''network_interfaces'', ''virtual_storage'', ''public_ips''].' - Any other input will be ignored. cloud_environment: default: AzureCloud description: - For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, C(AzureChinaCloud), C(AzureUSGovernment)), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the C(AZURE_CLOUD_ENVIRONMENT) environment variable. type: str version_added: 0.0.1 version_added_collection: azure.azcollection managed_disk_type: choices: - Standard_LRS - Premium_LRS description: - Managed disk type. adfs_authority_url: description: - Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. type: str version_added: 0.0.1 version_added_collection: azure.azcollection cert_validation_mode: choices: - ignore - validate description: - Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing C(ignore). Can also be set via credential file profile or the C(AZURE_CERT_VALIDATION) environment variable. type: str version_added: 0.0.1 version_added_collection: azure.azcollection ssh_password_enabled: default: true description: - When the os_type is Linux, setting ssh_password_enabled to false will disable SSH password authentication and require use of SSH keys. type: bool virtual_network_name: aliases: - virtual_network description: - Virtual Network name. x509_certificate_path: description: - Path to the X509 certificate used to create the service principal in PEM format. - The certificate must be appended to the private key. - Use when authenticating with a Service Principal. type: path version_added: 1.14.0 version_added_collection: azure.azcollection enable_accelerated_networking: description: - Indicates whether user wants to allow accelerated networking for virtual machines in scaleset being created. type: bool version_added: '2.7' version_added_collection: ansible.builtin virtual_network_resource_group: description: - When creating a virtual machine, if a specific virtual network from another resource group should be used, use this parameter to specify the resource group to use. version_added: '2.5' version_added_collection: ansible.builtin
azure_vmss: contains: properties: overprovision: true singlePlacementGroup: true upgradePolicy: mode: Manual virtualMachineProfile: networkProfile: networkInterfaceConfigurations: - name: testvmss properties: dnsSettings: dnsServers: [] enableAcceleratedNetworking: false ipConfigurations: - name: default properties: privateIPAddressVersion: IPv4 subnet: id: /subscriptions/XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX/resourceGroups/Testing/providers/Microsoft.Network/virtualNetworks/testvnet/subnets/testsubnet primary: true osProfile: adminUsername: testuser computerNamePrefix: testvmss linuxConfiguration: disablePasswordAuthentication: true ssh: publicKeys: - keyData: '' path: /home/testuser/.ssh/authorized_keys secrets: [] storageProfile: dataDisks: - caching: ReadWrite createOption: empty diskSizeGB: 64 lun: 0 managedDisk: storageAccountType: Standard_LRS imageReference: offer: CoreOS publisher: CoreOS sku: Stable version: 899.17.0 osDisk: caching: ReadWrite createOption: fromImage managedDisk: storageAccountType: Standard_LRS sku: capacity: 2 name: Standard_DS1_v2 tier: Standard tags: null type: Microsoft.Compute/virtualMachineScaleSets description: Facts about the current state of the object. Note that facts are not part of the registered output but available directly. returned: always type: complex