Documentation

alicloud_ess_task - Create or Terminate an scheduled task in ESS.

DEPRECATED

Removed in Ansible:
 version: 1.5.0
Why:Alibaba Cloud module name prefix “ali” will be more concise.
Alternative:Use ali_ess_task instead.

Synopsis

  • A scheduled task used to execute scaling activity in a scaling group automatically.
  • At most 20 scheduled tasks can be specified in a account.
  • When the trigger of a scheduled task fails because a scaling activity in a scaling group is in progress or the scaling group is disabled, the scheduled task is automatically retried within the LaunchExpirationTime; otherwise, the scheduled trigger task is abandoned.
  • If multiple tasks are scheduled at similar times to execute the rule of the same group, the earliest task triggers the scaling activity first, and other tasks make attempts to execute the rule within their Launch Expiration Time because a scaling group executes only one scaling activity at a time. If another scheduled task is still making triggering attempts within its Launch Expiration Time after the scaling activity is finished, the scaling rule is executed and the corresponding scaling activity is triggered.

Requirements

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

  • footmark >= 1.3.0
  • python >= 2.6

Parameters

Parameter Choices/Defaults Comments
alicloud_access_key
Aliyun Cloud access key. If not set then the value of environment variable ALICLOUD_ACCESS_KEY, ALICLOUD_ACCESS_KEY_ID will be used instead.

aliases: access_key_id, access_key
alicloud_region
The Aliyun Cloud region to use. If not specified then the value of environment variable ALICLOUD_REGION, ALICLOUD_REGION_ID will be used instead.

aliases: region, region_id
alicloud_secret_key
Aliyun Cloud secret key. If not set then the value of environment variable ALICLOUD_SECRET_KEY, ALICLOUD_SECRET_ACCESS_KEY will be used instead.

aliases: secret_access_key, secret_key
alicloud_security_token
The Aliyun Cloud security token. If not specified then the value of environment variable ALICLOUD_SECURITY_TOKEN will be used instead.

aliases: security_token
description
Description of the scheduled task, which is 2-200 characters (English or Chinese) long.
enabled
bool
    Choices:
  • no
  • yes ←
Whether to enable the scheduled task.
id
The ID of existing scheduled task.

aliases: task_id
launch_expiration Default:
600
Time period within which the failed scheduled task is retried, in second. Value range [0, 21600].

aliases: expiration
launch_time
Time point at which the scheduled task is triggered.
The date format follows the ISO8601 standard and uses UTC time. It is in the format of YYYY-MM-DDThh:mmZ.
If recurrence_type, the time point specified by this attribute is the default time point at which the circle is executed. Otherwise, the task is executed once on the designated date and time.
A time point 90 days after creation or modification cannot be inputted.
Required when state=present.
name
Display name of the scheduled task.
It must be 2-40 characters (English or Chinese) long, and begin with a number, an upper/lower-case letter or a Chinese character and may contain numbers, "_", "-" or ".".
Default to scheduled task ID.

aliases: task_name
recurrence_endtime
End time of the scheduled task to be repeated. The date format follows the ISO8601 standard and uses UTC time. It is in the format of YYYY-MM-DDThh:mmZ. A time point 90 days after creation or modification cannot be inputted.
recurrence_type, recurrence_value, recurrence_endtime must be specified or not at the same time.

aliases: endtime
recurrence_type
    Choices:
  • Daily
  • Weekly
  • Monthly
Type of the scheduled task to be repeated. Optional values 'Daily', 'Weekly' and 'Monthly' to indicates recurrence interval by day, week or month for a scheduled task.
recurrence_type, recurrence_value, recurrence_endtime must be specified or not at the same time.

aliases: type
recurrence_value
Value of the scheduled task to be repeated.
Daily should only supported one value in the range [1,31].
Weekly support multiple values. The values of Sunday to Saturday are 0 to 6 in sequence. Multiple values shall be separated by a comma ",".
Monthly use format A-B and the value range of A and B is 1 to 31, and the B value must be greater than the A value.
recurrence_type, recurrence_value, recurrence_endtime must be specified or not at the same time.

aliases: value
rule_id
ID of the scaling rule of a scheduled task. Required when state=present
state
    Choices:
  • present ←
  • absent
present to create a scheduled task and absent to delete it.

Notes

Note

  • If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence ALICLOUD_ACCESS_KEY or ALICLOUD_ACCESS_KEY_ID, ALICLOUD_SECRET_KEY or ALICLOUD_SECRET_ACCESS_KEY, ALICLOUD_REGION or ALICLOUD_REGION_ID, ALICLOUD_SECURITY_TOKEN
  • ALICLOUD_REGION or ALICLOUD_REGION_ID can be typically be used to specify the ALICLOUD region, when required, but this can also be configured in the footmark config file

Examples

- name: basic provisioning example
  hosts: localhost
  vars:
    alicloud_access_key: <your-alicloud-access-key-id>
    alicloud_secret_key: <your-alicloud-access-secret-key>
    alicloud_region: cn-beijing
    rule_id: asr-2zefe4bi0jpctd6z726p
    launch_time: 2018-01-09T15:00Z
    launch_expiration: 300
    recurrence_type: 'Daily'
    recurrence_value: 10
    recurrence_endtime: 2018-02-10T15:00Z
    name: task-from-ansible

  tasks:
    - name: launch scheduled task
      alicloud_ess_task:
        alicloud_access_key: '{{ alicloud_access_key }}'
        alicloud_secret_key: '{{ alicloud_secret_key }}'
        alicloud_region: '{{ alicloud_region }}'
        name: '{{ name }}'
        rule_id: '{{ rule.id }}'
        launch_time: '{{ launch_time }}'
        launch_expiration: '{{ launch_expiration }}'
        recurrence_type: '{{ recurrence_type }}'
        recurrence_value: '{{ recurrence_value }}'
        recurrence_endtime: '{{ recurrence_endtime }}'

    - name: delete specified scheduled task
      alicloud_ess_task:
        alicloud_access_key: '{{ alicloud_access_key }}'
        alicloud_secret_key: '{{ alicloud_secret_key }}'
        alicloud_region: '{{ alicloud_region }}'
        name: '{{ name }}'
        state: absent

Return Values

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

Key Returned Description
id
str
expect absent
Scheduled Task ID.

Sample:
cItPa1ec7ii6dryMmEbBnJZP
name
str
expect absent
Scheduled Task name.

Sample:
ess-task-foo
task
dict
expect absent
The details of a scheduled task.

Sample:
{'recurrence_value': '10', 'recurrence_endtime': '2018-02-10T15:00Z', 'description': None, 'launch_time': '2018-01-09T15:00Z', 'enabled': True, 'id': 'cItPa1ec7ii6dryMmEbBnJZP', 'recurrence_type': 'Daily', 'launch_expiration': 300, 'rule_ari': 'ari:acs:ess:cn-beijing:1204663572767468:scalingrule/asr-2zefe4bi0jpctd6z726p', 'name': 'ess-task-foo'}


Status

This module is flagged as deprecated and will be removed in version 1.5.0. For more information see DEPRECATED.

Author

  • He Guimin (@xiaozhu36)

Hint

If you notice any issues in this documentation you can edit this document to improve it.