azure_rm_autoscale – Manage Azure autoscale setting¶
New in version 2.7.
Requirements¶
The below requirements are needed on the host that executes this module.
python >= 2.7
azure >= 2.0.0
Parameters¶
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 | Returned | Description |
---|---|---|
state
dictionary
|
always |
Current state of the resource.
Sample:
{'changed': False, 'enabled': True, 'id': '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/microsoft.insights/autoscalesettings/scale', 'location': 'eastus', 'name': 'scale', 'notifications': [{'custom_emails': ['[email protected]'], 'send_to_subscription_administrator': True, 'send_to_subscription_co_administrators': False, 'webhooks': []}], 'profiles': [{'count': '1', 'max_count': '1', 'min_count': '1', 'name': 'Auto created scale condition 0', 'recurrence_days': ['Monday'], 'recurrence_frequency': 'Week', 'recurrence_hours': ['6'], 'recurrence_mins': ['0'], 'recurrence_timezone': 'China Standard Time', 'rules': [{'cooldown': 5.0, 'direction': 'Increase', 'metric_name': 'Percentage CPU', 'metric_resource_uri': '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsof t.Compute/virtualMachineScaleSets/MyVmss', 'operator': 'GreaterThan', 'statistic': 'Average', 'threshold': 70.0, 'time_aggregation': 'Average', 'time_grain': 1.0, 'time_window': 10.0, 'type': 'ChangeCount', 'value': '1'}]}], 'target': '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScale Sets/myVmss'}
|
Status¶
This module is not guaranteed to have a backwards compatible interface. [preview]
This module is maintained by the Ansible Community. [community]
Authors¶
Yuwei Zhou (@yuwzho)
Hint
If you notice any issues in this documentation, you can edit this document to improve it.