azure.azcollection.azure_rm_batchaccountpool module – Manages a Batch Account Pool on Azure

Note

This module is part of the azure.azcollection collection (version 3.1.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install azure.azcollection. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: azure.azcollection.azure_rm_batchaccountpool.

New in azure.azcollection 3.0.0

Synopsis

  • Create, update and delete instance of Azure Batch Account Pool.

Requirements

The below requirements are needed on the host that executes this module.

  • python >= 2.7

  • The host that executes this module must have the azure.azcollection collection installed via galaxy

  • All python packages listed in collection’s requirements.txt must be installed via pip on the host that executes modules from azure.azcollection

  • Full installation instructions may be found https://galaxy.ansible.com/azure/azcollection

Parameters

Parameter

Comments

ad_user

string

Active Directory username. Use when authenticating with an Active Directory user rather than service principal.

adfs_authority_url

string

added in azure.azcollection 0.0.1

Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority.

api_profile

string

added in azure.azcollection 0.0.1

Selects an API profile to use when communicating with Azure services. Default value of latest is appropriate for public clouds; future values will allow use with Azure Stack.

Default: "latest"

application_licenses

list / elements=string

The list of application licenses must be a subset of available Batch service application licenses.

If a license is requested which is not supported, pool creation will fail.

application_packages

list / elements=dictionary

Changes to application package references affect all new compute nodes joining the pool.

But do not affect compute nodes that are already in the pool until they are rebooted or reimaged.

There is a maximum of 10 application package references on any given pool.

id

string / required

The ID of the application package to install.

This must be inside the same batch account as the pool.

This can either be a reference to a specific version or the default version if one exists.

version

string

If this is omitted, and no default version is specified for this application, the request fails with the error code InvalidApplicationPackageReferences.

If you are calling the REST API directly, the HTTP status code is 409.

auth_source

string

added in azure.azcollection 0.0.1

Controls the source of the credentials to use for authentication.

Can also be set via the ANSIBLE_AZURE_AUTH_SOURCE environment variable.

When set to auto (the default) the precedence is module parameters -> env -> credential_file -> cli.

When set to env, the credentials will be read from the environment variables

When set to credential_file, it will read the profile from ~/.azure/credentials.

When set to cli, the credentials will be sources from the Azure CLI profile. subscription_id or the environment variable 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 msi, the host machine must be an azure resource with an enabled MSI extension. subscription_id or the environment variable 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 msi was added in Ansible 2.6.

Choices:

  • "auto" ← (default)

  • "cli"

  • "credential_file"

  • "env"

  • "msi"

batch_account_name

string / required

The name of the Batch Account.

cert_validation_mode

string

added in azure.azcollection 0.0.1

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 ignore. Can also be set via credential file profile or the AZURE_CERT_VALIDATION environment variable.

Choices:

  • "ignore"

  • "validate"

certificates

list / elements=dictionary

For Windows compute nodes, the Batch service installs the certificates to the specified certificate store and location.

For Linux compute nodes, the certificates are stored in a directory inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location.

For certificates with visibility of ‘remoteUser’, a ‘certs’ directory is created in the user’s home directory and certificates are placed in that directory.

id

string / required

The fully qualified ID of the certificate to install on the pool.

This must be inside the same batch account as the pool.

store_location

string

The default value is CurrentUser.

This property is applicable only for pools configured with Windows nodes.

For Linux compute nodes, the certificates are stored in a directory inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location.

For certificates with visibility of ‘remoteUser’, a ‘certs’ directory is created in the user’s home directory and certificates are placed in that directory.

Choices:

  • "CurrentUser" ← (default)

  • "LocalMachine"

store_name

string

This property is applicable only for pools configured with Windows nodes.

This created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows image reference.

Choices:

  • "My" ← (default)

  • "Root"

  • "CA"

  • "Trust"

  • "Disallowed"

  • "TrustedPeople"

  • "TrustedPublisher"

  • "AuthRoot"

  • "AddressBook"

visibility

list / elements=string

Which user accounts on the compute node should have access to the private data of the certificate.

Choices:

  • "StartTask"

  • "Task"

  • "RemoteUser"

client_id

string

Azure client ID. Use when authenticating with a Service Principal or Managed Identity (msi).

Can also be set via the AZURE_CLIENT_ID environment variable.

cloud_environment

string

added in azure.azcollection 0.0.1

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.

Default: "AzureCloud"

deployment_configuration

dictionary

Using CloudServiceConfiguration specifies that the nodes should be creating using Azure Cloud Services (PaaS).

Using VirtualMachineConfiguration uses Azure Virtual Machines (IaaS).

cloud_service_configuration

dictionary

This property and virtualMachineConfiguration are mutually exclusive and one of the properties must be specified.

This property cannot be specified if the Batch account was created with its poolAllocationMode property set to ‘UserSubscription’.

os_family

string

os_family=2 equivalent to Windows Server 2008 R2 SP1.

os_family=3 equivalent to Windows Server 2012.

os_family=4 equivalent to Windows Server 2012 R2.

os_family=5 equivalent to Windows Server 2016.

os_family=6 equivalent to Windows Server 2019.

Default: "*"

os_version

string

The default value is * which specifies the latest operating system version for the specified OS family.

virtual_machine_configuration

dictionary

This property and cloudServiceConfiguration are mutually exclusive and one of the properties must be specified.

container_configuration

dictionary

If specified, setup is performed on each node in the pool to allow tasks to run in containers.

All regular tasks and job manager tasks run on this pool must specify the containerSettings property.

All other tasks may specify it.

container_image_names

list / elements=string

This is the full image reference, as would be specified to “docker pull”.

An image will be sourced from the default Docker registry unless the image is fully qualified with an alternative registry.

container_registries

list / elements=dictionary

If any images must be downloaded from a private registry which requires credentials, then those credentials must be provided here.

identity_reference

dictionary

The reference to a user assigned identity associated with the Batch pool which a compute node will use.

resource_id

string

The ARM resource id of the user assigned identity.

password

string

The password to log into the registry server.

registry_server

string

If omitted, the default is docker.io.

Default: "docker.io"

user_name

string

The user name to log into the registry server.

type

string / required

The container technology to be used.

Choices:

  • "DockerCompatible"

  • "CriCompatible"

data_disks

list / elements=dictionary

This property must be specified if the compute nodes in the pool need to have empty data disks attached to them.

caching

string

The caching mode for the disk

Choices:

  • "None"

  • "ReadOnly"

  • "ReadWrite"

disk_size_gb

integer / required

The initial disk size in GB when creating new data disk.

lun

integer / required

The lun is used to uniquely identify each data disk.

If attaching multiple disks, each should have a distinct lun.

The value must be between 0 and 63, inclusive.

storage_account_type

string

The data disk type.

Standard_LRS for the data disk should use standard locally redundant storage.

Premium_LRS for the he data disk should use premium locally redundant storage.

Choices:

  • "Standard_LRS" ← (default)

  • "Premium_LRS"

  • "StandardSSD_LRS"

disk_encryption_configuration

dictionary

If specified, encryption is performed on each node in the pool during node provisioning.

targets

list / elements=string

On Linux pool, only TemporaryDisk is supported.

on Windows pool, OsDisk and TemporaryDisk must be specified.

Choices:

  • "TemporaryDisk"

  • "OsDisk"

extensions

list / elements=dictionary

If specified, the extensions mentioned in this configuration will be installed on each node.

auto_upgrade_minor_version

boolean

Indicates whether the extension should use a newer minor version if one is available at deployment time.

Once deployed, the extension will not upgrade minor versions unless redeployed, even with this property set to true.

Choices:

  • false

  • true

enable_automatic_upgrade

boolean

Indicates whether the extension should be automatically upgraded by the platform if there is a newer version of the extension available.

Choices:

  • false

  • true

name

string / required

The name of the virtual machine extension.

protected_settings

json

The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all.

provision_after_extensions

list / elements=string

Collection of extension names after which this extension needs to be provisioned.

publisher

string / required

The name of the extension handler publisher.

settings

json

JSON formatted public settings for the extension.

type

string / required

The type of the extensions.

type_handler_version

string

The version of script handler.

image_reference

dictionary / required

A reference to an Azure Virtual Machines Marketplace image or the zure Image resource of a custom Virtual Machine.

To get the list of all imageReferences verified by Azure Batch, see the ‘List supported node agent SKUs’ operation.

id

string

This property is mutually exclusive with other properties.

The Azure Compute Gallery Image must have replicas in the same region as the Azure Batch account.

Sample as '/subscriptions/{sub_Id}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}.

offer

string

For example, UbuntuServer or WindowsServer.

publisher

string

For example, Canonical or MicrosoftWindowsServer.

sku

string

For example, 18.04-LTS or 2022-datacenter.

version

string

A value of ‘latest’ can be specified to select the latest version of an image.

If omitted, the default is latest.

license_type

string

This only applies to images that contain the Windows operating system.

Should only be used when you hold valid on-premises licenses for the nodes which will be deployed.

Windows_Server, The on-premises license is for Windows Server.

Windows_Client, The on-premises license is for Windows Client.

node_agent_sku_id

string / required

The Batch node agent is a program that runs on each node in the pool.

Provides the command-and-control interface between the node and the Batch service.

There are different implementations of the node agent, known as SKUs, for different operating systems.

You must specify a node agent SKU which matches the selected image reference.

To get the list of supported node agent SKUs along with their list of verified image references.

node_placement_configuration

dictionary

This configuration will specify rules on how nodes in the pool during node provisioning.

policy

string

Allocation policy used by Batch Service to provision the nodes.

If not specified, Batch will use the regional policy.

Choices:

  • "Regional"

  • "Zonal"

os_disk

dictionary

Contains configuration for ephemeral OSDisk settings.

caching

string

The type of caching to enable for the disk.

Choices:

  • "None"

  • "ReadOnly"

  • "ReadWrite"

disk_size_gb

integer

The initial disk size in GB when creating new OS disk.

ephemeral_os_disk_settings

dictionary

Specifies the ephemeral Disk Settings for the operating system disk used by the virtual machine.

placement

string

This property can be used by user in the request to choose which location the operating system should be in.

managed_disk

dictionary

The data disk config.

storage_account_type

string

The storage account type for use in creating data disks or OSdisk.

Choices:

  • "Standard_LRS"

  • "Premium_LRS"

  • "StandardSSD_LRS"

write_accelerator_enabled

boolean

Specifies whether writeAccelerator should be enabled or disabled on the disk.

Choices:

  • false

  • true

security_profile

dictionary

Specifies the security profile settings for the virtual machine or virtual machine scale set.

encryption_at_host

boolean

This property can be used by user in the request to enable or disable the Host Encryption for the virtual machine or virtual machine scale set.

This willenable the encryption for all the disks including Resource/Temp disk at host itself.

Choices:

  • false

  • true

security_type

string

Specifies the SecurityType of the virtual machine.

It has to be set to any specified value to enable UefiSettings.

Default: "trustedLaunch"

uefi_settings

dictionary

Specifies the security settings like secure boot and vTPM used while creating the virtual machine.

secure_boot_enabled

boolean

Specifies whether secure boot should be enabled on the virtual machine.

Choices:

  • false

  • true

v_tpm_enabled

boolean

Specifies whether vTPM should be enabled on the virtual machine.

Choices:

  • false

  • true

service_artifact_reference

dictionary

The service artifact reference ID.

Such as /subscriptions/{subId}/resourceGroups/{testRG}/providers/Microsoft.Compute/galleries /{gName}/serviceArtifacts/{ArtName}/vmArtifactsProfiles/{ProfilesName}.

id

string

The service artifact reference ID of the vmArtifactsProfiles.

windows_configuration

dictionary

This property must not be specified if the imageReference specifies a Linux OS image.

enable_automatic_updates

boolean

If omitted, the default value is true.

Choices:

  • false

  • true ← (default)

disable_instance_discovery

boolean

added in azure.azcollection 2.3.0

Determines whether or not instance discovery is performed when attempting to authenticate. Setting this to true will completely disable both instance discovery and authority validation. This functionality is intended for use in scenarios where the metadata endpoint cannot be reached such as in private clouds or Azure Stack. The process of instance discovery entails retrieving authority metadata from https://login.microsoft.com/ to validate the authority. By setting this to **True**, the validation of the authority is disabled. As a result, it is crucial to ensure that the configured authority host is valid and trustworthy.

Set via credential file profile or the AZURE_DISABLE_INSTANCE_DISCOVERY environment variable.

Choices:

  • false ← (default)

  • true

display_name

string

The display name for the pool.

identity

dictionary

The type of identity used for the Batch Pool.

If the pool identity is updated during update an existing pool.

Only the new vms which are created after the pool shrinks to 0 will have the updated identities.

type

string / required

The type of identity used for the Batch Pool.

Choices:

  • "None"

  • "UserAssigned"

user_assigned_identities

dictionary

The list of user identities associated with the Batch pool.

The key is the identity’s ID and value contains ‘principal_id’ and ‘client_id’.

inter_node_communication

string

This imposes restrictions on which nodes can be assigned to the pool.

Enabling this value can reduce the chance of the requested number of nodes to be allocated in the pool.

If not specified, this value defaults to Disabled.

Choices:

  • "Enabled"

  • "Disabled"

is_disable_auto_scale

boolean

Whether disables automatic scaling for a pool.

Choices:

  • false ← (default)

  • true

is_stop_resize

boolean

Whether stops an ongoing resize operation on the pool.

Choices:

  • false ← (default)

  • true

log_mode

string

Parent argument.

log_path

string

Parent argument.

metadata

list / elements=dictionary

The Batch service does not assign any meaning to this metadata; it is solely for the use of user code.

name

string / required

The name of the metadata item.

value

string / required

The value of the metadata item.

mount_configuration

list / elements=dictionary

This supports Azure Files, NFS, CIFS/SMB, and Blobfuse.

azure_blob_file_system_configuration

dictionary

Configuration of the azure blob file system.

This property is mutually exclusive with all other properties.

account_key

string

This property is mutually exclusive with both sasKey and identity; exactly one must be specified.

account_name

string / required

The Azure Storage Account name.

blobfuse_options

string

These are net use options in Windows and mount options in Linux.

Choices:

  • "net use"

  • "mount"

container_name

string / required

The Azure Blob Storage Container name.

identity_reference

dictionary

This property is mutually exclusive with both accountKey and sasKey; exactly one must be specified.

resource_id

string

The ARM resource id of the user assigned identity.

relative_mount_path

string / required

All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable.

sas_key

string

This property is mutually exclusive with both accountKey and identity; exactly one must be specified.

azure_file_share_configuration

dictionary

Configuration of the azure file share.

This property is mutually exclusive with all other properties.

account_key

string / required

The Azure Storage account key.

account_name

string / required

The Azure Storage account name.

azure_file_url

string / required

This is of the form ‘https://{account}.file.core.windows.net/’.

mount_options

string

These are net use options in Windows and mount options in Linux.

Choices:

  • "net use"

  • "mount"

relative_mount_path

string / required

All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable.

cifs_mount_configuration

dictionary

Configuration of the cifs mount.

This property is mutually exclusive with all other properties.

mount_options

string

These are net use options in Windows and mount options in Linux.

Choices:

  • "net use"

  • "mount"

password

string / required

The password to use for authentication against the CIFS file system.

relative_mount_path

string / required

All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable.

source

string / required

The URI of the file system to mount.

user_name

string / required

The user to use for authentication against the CIFS file system.

nfs_mount_configuration

dictionary

Configuration of the nfs mount.

This property is mutually exclusive with all other properties.

mount_options

string

These are net use options in Windows and mount options in Linux.

Choices:

  • "net use"

  • "mount"

relative_mount_path

string / required

All file systems are mounted relative to the Batch mounts directory, accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable.

source

string / required

The URI of the file system to mount.

name

string / required

The name of the Batch Account Pool.

network_configuration

dictionary

The network configuration for a pool.

dynamic_vnet_assignment_scope

string

The scope of dynamic vnet assignment.

Choices:

  • "none"

  • "job"

enable_accelerated_networking

boolean

Accelerated networking enables single root I/O virtualization (SR-IOV) to a VM.

Which may lead to improved networking performance.

Choices:

  • false

  • true

endpoint_configuration

dictionary

Pool endpoint configuration is only supported on pools with the virtualMachineConfiguration property.

inbound_nat_pools

list / elements=dictionary

The maximum number of inbound NAT pools per Batch pool is 5.

If the maximum number of inbound NAT pools is exceeded the request fails with HTTP status code 400.

backend_port

integer / required

This must be unique within a Batch pool.

Acceptable values are between 1 amd 65535 except for 22.

frontend_port_range_end

integer / required

Acceptable values range between 1 and 65534 except ports from 50000 to 55000 which are reserved by the Batch service.

All ranges within a pool must be distinct and cannot overlap.

frontend_port_range_start

integer / required

Acceptable values range between 1 and 65534 except ports overlap

If any reserved or overlapping values are provided the request fails with HTTP status code 400.

name

string / required

The name must be unique within a Batch pool.

The name contain letters, numbers, underscores, periods, and hyphens.

network_security_group_rules

list / elements=dictionary

The maximum number of rules that can be specified across all the endpoints on a Batch pool is 25.

If no network security group rules are specified.

default rule will be created to allow inbound access to the specified backendPort.

access

string / required

The action that should be taken for a specified IP address, subnet range or tags.

Choices:

  • "Allow"

  • "Deny"

priority

integer / required

Priorities within a pool must be unique and are evaluated in order of priority

source_address_prefix

string

Valid values are a single IP address (i.e. 10.10.10.10).

Valid values are a single IP address.

source_port_ranges

list / elements=string

Valid values are ‘*’ (for all ports 0 - 65535) or arrays of orts or port ranges (i.e. 100-200).

protocol

string / required

The protocol of the endpoint.

Choices:

  • "UDP"

  • "TCP"

public_ip_address_configuration

dictionary

This property is only supported on Pools with the virtualMachineConfiguration property.

ip_address_ids

list / elements=string

The number of IPs specified here limits the maximum size of the Pool 100 dedicated nodes or 100 Spot/low-priority nodes can be allocated for each public IP.

provision

string

The public IP Address configuration’s provision.

Choices:

  • "BatchManaged" ← (default)

  • "UserManaged"

  • "NoPublicIPAddresses"

subnet_id

string

The virtual network must be in the same region and subscription as the Azure Batch account.

The specified subnet should have enough free IP addresses to accommodate the number of nodes in the pool.

If the subnet doesn’t have enough free IP addresses, the pool will partially allocate compute nodes and a resize error will occur.

password

string

Active Directory user password. Use when authenticating with an Active Directory user rather than service principal.

profile

string

Security profile found in ~/.azure/credentials file.

resource_group

string / required

The name of the resource group in which to create the Batch Account Pool.

resource_tags

dictionary

The user-defined tags to be associated with the Azure Batch Pool.

When specified, these tags are propagated to the backing Azure resources associated with the pool.

This property can only be specified when the Batch account was created with the poolAllocationMode property set to ‘UserSubscription’.

scale_settings

dictionary

Defines the desired size of the pool.

This can either be ‘fixedScale’ where the requested targetDedicatedNodes is specified, or ‘autoScale’ which defines a formula which is periodically reevaluated.

If this property is not specified, the pool will have a fixed scale with 0 targetDedicatedNodes.

auto_scale

dictionary

This property and fixedScale are mutually exclusive and one of the properties must be specified. must be specified.

evaluation_interval

string

If omitted, the default value is 15 minutes (PT15M).

Default: "P15M"

formula

string / required

A formula for the desired number of compute nodes in the pool.

fixed_scale

dictionary

This property and autoScale are mutually exclusive and one of the properties must be specified.

node_deallocation_option

string

If omitted, the default value is Requeue.

Choices:

  • "Requeue"

  • "Terminate"

  • "TaskCompletion"

  • "RetainedData"

resize_timeout

string

The default value is 15 minutes P15M.

Timeout values use ISO 8601 format. For example, use PT10M for 10 minutes.

The minimum value is 5 minutes.

If you specify a value less than 5 minutes, the Batch service rejects the request with an error.

Default: "P15M"

target_dedicated_nodes

integer

At least one of targetDedicatedNodes, targetLowPriorityNodes must be set.

target_low_priority_nodes

integer

At least one of targetDedicatedNodes, targetLowPriorityNodes must be set.

secret

string

Azure client secret. Use when authenticating with a Service Principal.

start_task

dictionary

In an PATCH (update) operation, this property can be set to an empty object to remove the start task from the pool.

command_line

string

The command line does not run under a shell, and therefore cannot take advantage of shell features such as environment variable expansion.

If you want to take advantage of such features, you should invoke the shell in the command line.

Required if any other properties of the startTask are specified.

container_settings

dictionary

When this is specified, all directories recursively below the AZ_BATCH_NODE_ROOT_DIR are mapped into the container, all task environment variables are mapped into the container, and the task command line is executed in the container.

container_run_options

string

These additional options are supplied as arguments to the ‘docker create’ command, in addition to those controlled by the Batch Service.

image_name

string

This is the full image reference, as would be specified to “docker pull”.

If no tag is provided as part of the image name, the tag “:latest” is used as a default.

registry

dictionary

This setting can be omitted if was already provided at pool creation.

identity_reference

dictionary

The reference to a user assigned identity associated with the Batch pool which a compute node will use.

resource_id

string

The ARM resource id of the user assigned identity.

password

string

The password to log into the registry server.

registry_server

string

If omitted, the default is “docker.io”.

Default: "docker.io"

user_name

string

he user name to log into the registry server.

working_directory

string

A flag to indicate where the container task working directory is.

Choices:

  • "TaskWorkingDirectory"

  • "ContainerImageDefault"

environment_settings

list / elements=dictionary

A list of environment variable settings for the start task.

name

string / required

The name of the environment variable.

value

string

The value of the environment variable.

max_task_retry_count

integer

The Batch service retries a task if its exit code is nonzero.

Note that this value specifically controls the number of retries.

The Batch service will try the task once, and may then retry up to this limit.

Default: 0

resource_files

list / elements=dictionary

A list of files that the Batch service will download to the compute node before running the command line.

A single file or multiple files to be downloaded to a compute node.

auto_storage_container_name

string

The autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified.

blob_prefix

string

The property is valid only when autoStorageContainerName or storageContainerUrl is used.

This prefix can be a partial filename or a subdirectory.

If a prefix is not specified, all the files in the container will be downloaded.

file_mode

string

This property applies only to files being downloaded to Linux compute nodes.

It will be ignored if it is specified for a resourceFile which will be downloaded to a Windows node.

If this property is not specified for a Linux node, then a default value of 0770 is applied to the file.

file_path

string

If the httpUrl property is specified, the filePath is required and describes the path which the file will be downloaded to, including the filename.

If the autoStorageContainerName or storageContainerUrl property is specified, filePath is optional and is the directory to download the files to.

In the case where filePath is used as a directory, any directory structure already associated with the input data will be retained in full and appended to the specified filePath directory.

The specified relative path cannot break out of the task’s working directory.

http_url

string

The autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified.

If the URL points to Azure Blob Storage, it must be readable from compute nodes.

There are three ways to get such a URL for a blob in Azure storage.

Include a Shared Access Signature (SAS) granting read permissions on the blob, use a managed identity with read permission, or set the ACL for the blob or its container to allow public access.

identity_reference

dictionary

The reference to a user assigned identity associated with the Batch pool which a compute node will use.

resource_id

string

The ARM resource id of the user assigned identity.

storage_container_url

string

The autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually exclusive and one of them must be specified.

This URL must be readable and listable from compute nodes.

There are three ways to get such a URL for a container in Azure storage.

Include a Shared Access Signature (SAS) granting read and list permissions on the container, use a managed identity with read and list permissions, or set the ACL for the container to allow public access.

user_identity

dictionary

If omitted, the task runs as a non-administrative user unique to the task.

auto_user

dictionary

The autouser config of the task user identity.

The userName and autoUser properties are mutually exclusive; you must specify one but not both.

elevation_level

string

The auto user elevation level.

Choices:

  • "NonAdmin" ← (default)

  • "Admin"

scope

string

The scope of the auto user scope.

The default value is Pool.

If the pool is running Windows a value of Task should be specified if stricter isolation between tasks is required.

Choices:

  • "Task"

  • "Pool" ← (default)

user_name

string

The username of the task user identity.

The userName and autoUser properties are mutually exclusive; you must specify one but not both.

wait_for_success

boolean

If true and the start task fails on a compute node.

The Batch service retries the start task up to its maximum retry count (maxTaskRetryCount).

If the task has still not completed successfully after all retries, then the Batch service marks the compute node unusable, and will not schedule tasks to it.

This condition can be detected via the node state and scheduling error detail.

If false, the Batch service will not wait for the start task to complet.

Choices:

  • false

  • true

state

string

Assert the state of the Batch Account Pool.

Use present to create or update a Batch Account Pool and absent to delete it.

Choices:

  • "present" ← (default)

  • "absent"

subscription_id

string

Your Azure subscription Id.

target_node_communication_mode

string

If omitted, the default value is Default.

Choices:

  • "Default" ← (default)

  • "Classic"

  • "Simplified"

task_scheduling_policy

dictionary

Specifies how tasks should be distributed across compute nodes.

node_fill_type

string

How tasks should be distributed across compute nodes.

Choices:

  • "Spread"

  • "Pack"

task_slots_per_node

integer

The default value is 1.

The maximum value is the smaller of 4 times the number of cores of the vmSize of the pool or 256.

Default: 1

tenant

string

Azure tenant ID. Use when authenticating with a Service Principal.

thumbprint

string

added in azure.azcollection 1.14.0

The thumbprint of the private key specified in x509_certificate_path.

Use when authenticating with a Service Principal.

Required if x509_certificate_path is defined.

upgrade_policy

dictionary

Describes an upgrade policy.

automatic_os_upgrade_policy

dictionary

The configuration parameters used for performing automatic OS upgrade.

disable_automatic_rollback

boolean

Whether OS image rollback feature should be disabled.

Choices:

  • false

  • true

enable_automatic_os_upgrade

boolean

Indicates whether OS upgrades should automatically be applied to scale set instances in a rolling fashion when a newer version of the OS image becomes available.

Choices:

  • false

  • true

os_rolling_upgrade_deferral

boolean

Defer OS upgrades on the TVMs if they are running tasks.

Choices:

  • false

  • true

use_rolling_upgrade_policy

boolean

Indicates whether rolling upgrade policy should be used during Auto OS Upgrade.

Auto OS Upgrade will fallback to the default policy if no policy is defined on the VMSS.

Choices:

  • false

  • true

mode

string / required

Specifies the mode of an upgrade to virtual machines in the scale set.

Choices:

  • "automatic"

  • "manual"

  • "rolling"

rolling_upgrade_policy

dictionary

This property is only supported on Pools with the virtualMachineConfiguration property.

enable_cross_zone_upgrade

boolean

Allow VMSS to ignore AZ boundaries when constructing upgrade batches.

Take into consideration the Update Domain and maxBatchInstancePercent to determine the batch size.

If this field is not set, Azure Azure Batch will not set its default value.

The value of enableCrossZoneUpgrade on the created VirtualMachineScaleSet will be decided by the default configurations on VirtualMachineScaleSet.

This field is able to be set to true or false only when using NodePlacementConfiguration as Zonal.

Choices:

  • false

  • true

max_batch_instance_percent

integer

The maximum percent of total virtual machine instances that will be upgraded simultaneously by the rolling upgrade in one batch.

As this is a maximum, unhealthy instances in previous or future batches can cause the percentage of instances in a batch to decrease to ensure higher reliability.

The value of this field should be between 5 and 100, inclusive.

If both maxBatchInstancePercent and maxUnhealthyInstancePercent are assigned with value, the value of maxBatchInstancePercent should not be more than maxUnhealthyInstancePercent.

max_unhealthy_instance_percent

integer

The maximum percentage of the total virtual machine instances in the scale set that can be simultaneously unhealthy, either as a result of being upgraded, or by being found in an unhealthy state by the virtual machine health checks before the rolling upgrade aborts.

This constraint will be checked prior to starting any batch.

If both maxBatchInstancePercent and maxUnhealthyInstancePercent are assigned with value, the value of maxBatchInstancePercent should not be more than maxUnhealthyInstancePercent.

max_unhealthy_upgraded_instance_percent

integer

The maximum percentage of upgraded virtual machine instances that can be found to be in an unhealthy state.

This check will happen after each batch is upgraded.

If this percentage is ever exceeded, the rolling update aborts.

The value of this field should be between 0 and 100, inclusive.

pause_time_between_batches

string

The wait time between completing the update for all virtual machines in one batch and starting the next batch.

The time duration should be specified in ISO 8601 format.

prioritize_unhealthy_instances

boolean

Upgrade all unhealthy instances in a scale set before any healthy instances.

Choices:

  • false

  • true

rollback_failed_instances_on_policy_breach

boolean

Rollback failed instances to previous model if the Rolling Upgrade policy is violated.

Choices:

  • false

  • true

user_accounts

list / elements=dictionary

The list of user accounts to be created on each node in the pool.

elevation_level

string

NonAdmin - the auto user is a standard user without elevated access.

Admin - The auto user is a user with elevated access and operates with full Administrator permissions.

Choices:

  • "NonAdmin" ← (default)

  • "Admin"

linux_user_configuration

dictionary

Properties used to create a user account on a Linux node.

gid

integer

The uid and gid properties must be specified together or not at all.

If not specified the underlying operating system picks the gid.

ssh_private_key

string

The private key must not be password protected.

The private key is used to automatically configure asymmetric-key based authentication for SSH between nodes in a Linux pool when the pool’s enableInterNodeCommunication property is true.

It does this by placing the key pair into the user’s .ssh directory.

If not specified, password-less SSH is not configured between nodes (no modification of the user’s .ssh directory is done).

uid

integer

The uid and gid properties must be specified together or not at all.

If not specified the underlying operating system picks the uid.

name

string / required

The name of the user account. Names can contain any Unicode characters up to a maximum length of 20.

password

string / required

The password for the user account.

windows_user_configuration

dictionary

Properties used to create a user account on a Windows node.

login_mode

string

Specifies login mode for the user.

The default value for VirtualMachineConfiguration pools is interactive mode and for CloudServiceConfiguration pools is batch mode.

Choices:

  • "Batch"

  • "Interactive"

vm_size

string

For information about available sizes of virtual machines for Cloud Services Pools.

Batch supports all Cloud Services VM sizes except ExtraSmall, A1V2 and A2V2,

Batch supports all Azure VM sizes except STANDARD_A0 and those with premium storage (STANDARD_GS, STANDARD_DS, and STANDARD_DSV2 series).

x509_certificate_path

path

added in azure.azcollection 1.14.0

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.

Notes

Note

  • For authentication with Azure you can pass parameters, set environment variables, use a profile stored in ~/.azure/credentials, or log in before you run your tasks or playbook with az login.

  • Authentication is also 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.

See Also

See also

Sign in with Azure CLI

How to authenticate using the az login command.

Examples

- name: Create a new batch account pool
  azure_rm_batchaccountpool:
    resource_group: "{{ resource_group }}"
    batch_account_name: "{{ batch_account_name }}"
    name: "pool{{ batch_account_name }}--004"
    deployment_configuration:
      virtual_machine_configuration:
        image_reference:
          offer: ubuntu-hpc
          publisher: microsoft-dsvm
          sku: 2204
          version: latest
        node_agent_sku_id: batch.node.ubuntu 22.04
        node_placement_configuration:
          policy: Regional
        os_disk:
          caching: None
          managed_disk:
            storage_account_type: Premium_LRS
    display_name: "fredtest01"
    identity:
      type: UserAssigned
      user_assigned_identities:
        '/subscriptions/xxx-xxx/resourceGroups/testRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/AzSecPackAutoConfigUA-westus':
          client_id: xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
          principal_id: yyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy
        '/subscriptions/xxx-xxx/resourceGroups/yishitest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ystestidentity':
          client_id: yyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy
          principal_id: xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
    inter_node_communication: Disabled
    network_configuration:
      dynamic_vnet_assignment_scope: none
      subnet_id: "/subscriptions/xxx-xxx/resourceGroups/testRG/providers/Microsoft.Network/virtualNetworks/vnet02/subnets/default"
      endpoint_configuration:
        inbound_nat_pools:
          - backend_port: 33
            frontend_port_range_end: 49999
            frontend_port_range_start: 1
            name: nat02
            protocol: UDP
      public_ip_address_configuration:
        provision: BatchManaged
    scale_settings:
      fixed_scale:
        resize_timeout: PT15M
        target_dedicated_nodes: 0
        target_low_priority_nodes: 0
    target_node_communication_mode: Default
    task_scheduling_policy:
      node_fill_type: Pack
    task_slots_per_node: 1
    vm_size: STANDARD_D2S_V3
    upgrade_policy:
      mode: manual
      rolling_upgrade_policy:
        max_batch_instance_percent: 20
        max_unhealthy_instance_percent: 20
        max_unhealthy_upgraded_instance_percent: 20
        pause_time_between_batches: P0D
        rollback_failed_instances_on_policy_breach: false
      automatic_os_upgrade_policy:
        disable_automatic_rollback: false
        enable_automatic_os_upgrade: false
        os_rolling_upgrade_deferral: false
        use_rolling_upgrade_policy: false

- name: Delete the Batch Account Pool
  azure_rm_batchaccountpool:
    resource_group: MyResGroup
    name: pool01
    batch_account_name: mybatchaccount
    state: absent

Return Values

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

Key

Description

state

dictionary

Contains information about an pool in a Batch account.

Returned: always

Sample: {"allocation_state": "Steady", "allocation_state_transition_time": "2024-11-05T08:58:16.803138Z", "batch_account_name": "fredbatch02", "creation_time": "2024-11-05T08:58:15.399345Z", "current_dedicated_nodes": 0, "current_low_priority_nodes": 0, "deployment_configuration": {"virtual_machine_configuration": {"image_reference": {"offer": "ubuntu-hpc", "publisher": "microsoft-dsvm", "sku": "2204", "version": "latest"}, "node_agent_sku_id": "batch.node.ubuntu 22.04", "node_placement_configuration": {"policy": "Regional"}, "os_disk": {"caching": "None", "managed_disk": {"storage_account_type": "Premium_LRS"}}}}, "etag": "0x8DCFD77FC345CFE", "id": "/subscriptions/xxx-xxx/resourceGroups/testRG/providers/Microsoft.Batch/batchAccounts/batch01/pools/pool01", "inter_node_communication": "Disabled", "last_modified": "2024-11-05T08:58:15.399347Z", "name": "poolfredbatch02--002", "network_configuration": {"dynamic_vnet_assignment_scope": "None", "enable_accelerated_networking": false, "endpoint_configuration": {"inbound_nat_pools": [{"backend_port": 33, "frontend_port_range_end": 49999, "frontend_port_range_start": 1, "name": "nat02", "protocol": "UDP"}]}, "public_ip_address_configuration": {"provision": "BatchManaged"}, "subnet_id": "/subscriptions/xxx-xxx/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vnet01/subnets/default"}, "provisioning_state": "Succeeded", "provisioning_state_transition_time": "2024-11-05T08:58:15.399345Z", "resize_operation_status": {"node_deallocation_option": "Requeue", "resize_timeout": "PT15M", "start_time": "2024-11-05T08:58:15.399317Z", "target_dedicated_nodes": 0}, "resource_group": "v-xisuRG06", "scale_settings": {"fixed_scale": {"resize_timeout": "PT15M", "target_dedicated_nodes": 0, "target_low_priority_nodes": 0}}, "target_node_communication_mode": "Default", "task_scheduling_policy": {"node_fill_type": "Pack"}, "task_slots_per_node": 1, "type": "Microsoft.Batch/batchAccounts/pools", "upgrade_policy": {"automatic_os_upgrade_policy": {"disable_automatic_rollback": false, "enable_automatic_os_upgrade": false, "os_rolling_upgrade_deferral": false, "use_rolling_upgrade_policy": false}, "mode": "Manual", "rolling_upgrade_policy": {"max_batch_instance_percent": 20, "max_unhealthy_instance_percent": 20, "max_unhealthy_upgraded_instance_percent": 20, "pause_time_between_batches": "P0D", "rollback_failed_instances_on_policy_breach": false}}, "vm_size": "STANDARD_D2S_V3"}

Authors

  • xuzhang3 (@xuzhang3)

  • Fred Sun (@Fred-sun)