azure_rm_virtualmachine_scaleset - Manage Azure virtual machine scale sets.

New in version 2.4.

Synopsis

  • Create and update a virtual machine scale set.

Requirements (on host that executes module)

  • python >= 2.7
  • azure >= 2.0.0

Options

parameter required default choices comments
ad_user
no
Active Directory username. Use when authenticating with an Active Directory user rather than service principal.
admin_password
no
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
no
Admin username used to access the host after it is created. Required when creating a VM.
append_tags
no True
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.
capacity
yes
Capacity of VMSS
client_id
no
Azure client ID. Use when authenticating with a Service Principal.
cloud_environment
no AzureCloud
For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, AzureChinaCloud, AzureUSGovernment), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the AZURE_CLOUD_ENVIRONMENT environment variable.
data_disks
(added in 2.4)
no
Describes list of data disks.
Dictionary object data_disks
parameter required default choices comments
caching
(added in 2.4)
no ReadOnly
  • ReadOnly
  • ReadWrite
Type of data disk caching.
managed_disk_type
(added in 2.4)
no
  • Standard_LRS
  • Premium_LRS
Managed data disk type
disk_size_gb
(added in 2.4)
no
The initial disk size in GB for blank data disks
lun
(added in 2.4)
no
The logical unit number for data disk
image
yes
A dictionary describing the Marketplace image used to build the VM. Will contain keys: publisher, offer, sku and version. NOTE: set image.version to 'latest' to get the most recent version of a given image.
location
no
Valid Azure location. Defaults to location of the resource group.
managed_disk_type
no
  • Standard_LRS
  • Premium_LRS
Managed disk type
name
yes
Name of the virtual machine.
os_disk_caching
no ReadOnly
  • ReadOnly
  • ReadWrite
Type of OS disk caching.
aliases: disk_caching
os_type
no [u'Linux']
  • Windows
  • Linux
Base type of operating system.
password
no
Active Directory user password. Use when authenticating with an Active Directory user rather than service principal.
profile
no
Security profile found in ~/.azure/credentials file.
remove_on_absent
no [u'all']
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
resource_group
yes
Name of the resource group containing the virtual machine scale set.
secret
no
Azure client secret. Use when authenticating with a Service Principal.
ssh_password_enabled
no True
When the os_type is Linux, setting ssh_password_enabled to false will disable SSH password authentication and require use of SSH keys.
ssh_public_keys
no
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.
state
no present
  • absent
  • present
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.
subnet_name
no
Subnet name
aliases: subnet
subscription_id
no
Your Azure subscription Id.
tags
no
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.
tenant
no
Azure tenant ID. Use when authenticating with a Service Principal.
tier
no
  • Basic
  • Standard
SKU Tier
upgrade_policy
no
  • Manual
  • Automatic
Upgrade policy
virtual_network_name
no
Virtual Network name
aliases: virtual_network
vm_size
yes
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.

Examples

- 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

Return Values

Common return values are documented here Return Values, the following are the fields unique to this module:

name description returned type sample
azure_vmss
Facts about the current state of the object. Note that facts are not part of the registered output but available directly.
always complex
contains:
name description returned type sample
sku
type
properties
tags

Notes

Note

  • For authentication with Azure you can pass parameters, set environment variables or use a profile stored in ~/.azure/credentials. Authentication is possible using a service principal or Active Directory user. To authenticate via service principal, pass subscription_id, client_id, secret and tenant or set environment variables AZURE_SUBSCRIPTION_ID, AZURE_CLIENT_ID, AZURE_SECRET and AZURE_TENANT.
  • To authenticate via Active Directory user, pass ad_user and password, or set AZURE_AD_USER and AZURE_PASSWORD in the environment.
  • Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing a [default] section and the following keys: subscription_id, client_id, secret and tenant or subscription_id, ad_user and password. It is also possible to add additional profiles. Specify the profile by passing profile or setting AZURE_PROFILE in the environment.

Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.4/azure_rm_virtualmachine_scaleset_module.html