azure.azcollection.azure_rm_autoscale module – Manage Azure autoscale setting
Note
This module is part of the azure.azcollection collection (version 2.7.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_autoscale
.
New in azure.azcollection 0.1.2
Synopsis
Create, delete an autoscale setting.
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 |
---|---|
Active Directory username. Use when authenticating with an Active Directory user rather than service principal. |
|
Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. |
|
Selects an API profile to use when communicating with Azure services. Default value of Default: |
|
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. Choices:
|
|
Controls the source of the credentials to use for authentication. Can also be set via the When set to When set to When set to When set to When set to The Choices:
|
|
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 Choices:
|
|
Azure client ID. Use when authenticating with a Service Principal or Managed Identity (msi). Can also be set via the |
|
For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, Default: |
|
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 Choices:
|
|
Specifies whether automatic scaling is enabled for the resource. Choices:
|
|
location of the resource. |
|
Parent argument. |
|
Parent argument. |
|
name of the resource. |
|
The collection of notifications. |
|
The custom e-mails list. This value can be null or empty, in which case this attribute will be ignored. |
|
A value indicating whether to send email to subscription administrator. Choices:
|
|
A value indicating whether to send email to subscription co-administrators. Choices:
|
|
The list of webhook notifications service uri. |
|
Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. |
|
Security profile found in ~/.azure/credentials file. |
|
The collection of automatic scaling profiles that specify different scaling parameters for different time periods. A maximum of 20 profiles can be specified. |
|
The number of instances that will be set if metrics are not available for evaluation. The default is only used if the current instance count is lower than the default. |
|
The specific date-time end for the profile. This element is not used if the Recurrence element is used. |
|
The specific date-time start for the profile. This element is not used if the Recurrence element is used. |
|
The specific date-time timezone for the profile. This element is not used if the Recurrence element is used. |
|
The maximum number of instances for the resource. The actual maximum number of instances is limited by the cores that are available in the subscription. |
|
The minimum number of instances for the resource. |
|
The name of the profile. |
|
The days of repeating times at which this profile begins. This element is not used if the FixedDate element is used. |
|
How often the schedule profile should take effect. If this value is This element is not used if the FixedDate element is used. Choices:
|
|
The hours of repeating times at which this profile begins. This element is not used if the FixedDate element is used. |
|
The mins of repeating times at which this profile begins. This element is not used if the FixedDate element is used. |
|
The timezone of repeating times at which this profile begins. This element is not used if the FixedDate element is used. |
|
The collection of rules that provide the triggers and parameters for the scaling action. A maximum of 10 rules can be specified. |
|
The amount of time (minutes) to wait since the last scaling action before this action occurs. It must be between 1 ~ 10080. |
|
Whether the scaling action increases or decreases the number of instances. Choices:
|
|
The name of the metric that defines what the rule monitors. |
|
The resource identifier of the resource the rule monitors. |
|
The operator that is used to compare the metric data and the threshold. Choices:
|
|
How the metrics from multiple instances are combined. Choices:
|
|
The threshold of the metric that triggers the scale action. Default: |
|
How the data that is collected should be combined over time. Choices:
|
|
The granularity(minutes) of metrics the rule monitors. Must be one of the predefined values returned from metric definitions for the metric. Must be between 1 ~ 720. |
|
The range of time(minutes) in which instance data is collected. This value must be greater than the delay in metric collection, which can vary from resource-to-resource. Must be between 5 ~ 720. |
|
The type of action that should occur when the scale rule fires. Choices:
|
|
The number of instances that are involved in the scaling action. This value must be 1 or greater. |
|
Resource group of the resource. |
|
Azure client secret. Use when authenticating with a Service Principal. |
|
Assert the state of the virtual network. Use Choices:
|
|
Your Azure subscription Id. |
|
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. |
|
The identifier of the resource to apply autoscale setting. It could be the resource id string. It also could be a dict contains the |
|
Azure tenant ID. Use when authenticating with a Service Principal. |
|
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. |
|
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 an auto scale
azure_rm_autoscale:
target: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/myVmss"
enabled: true
profiles:
- count: '1'
recurrence_days:
- Monday
name: Auto created scale condition
recurrence_timezone: China Standard Time
recurrence_mins:
- '0'
min_count: '1'
max_count: '1'
recurrence_frequency: Week
recurrence_hours:
- '18'
name: scale
resource_group: myResourceGroup
- name: Create an auto scale with complicated profile
azure_rm_autoscale:
target: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets
/myVmss"
enabled: true
profiles:
- count: '1'
recurrence_days:
- Monday
name: Auto created scale condition 0
rules:
- time_aggregation: Average
time_window: 10
direction: Increase
metric_name: Percentage CPU
metric_resource_uri: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtua
lMachineScaleSets/vmss"
value: '1'
threshold: 70
cooldown: 5
time_grain: 1
statistic: Average
operator: GreaterThan
type: ChangeCount
max_count: '1'
recurrence_mins:
- '0'
min_count: '1'
recurrence_timezone: China Standard Time
recurrence_frequency: Week
recurrence_hours:
- '6'
notifications:
- email_admin: true
email_co_admin: false
custom_emails:
- [email protected]
name: scale
resource_group: myResourceGroup
- name: Delete an Azure Auto Scale Setting
azure_rm_autoscale:
state: absent
resource_group: myResourceGroup
name: scale
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Current state of the resource. Returned: always Sample: |