opentelekomcloud.cloud.as_policy (0.14.2) — module

Create/Remove Auto Scaling Policy from the OTC

| "added in version" 0.8.0 of opentelekomcloud.cloud"

Authors: Irina Pereiaslavskaia (@irina-pereiaslavskaia)

Install collection

Install with ansible-galaxy collection install opentelekomcloud.cloud:==0.14.2


Add to requirements.yml

  collections:
    - name: opentelekomcloud.cloud
      version: 0.14.2

Description

Create/Remove Auto Scaling Policy from the OTC.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Create AS Policy
- opentelekomcloud.cloud.as_policy:
    scaling_group: "as-group-test"
    scaling_policy: "collection-test"
    scaling_policy_type: "alarm"
    alarm: "as-alarm-test"
  register: result
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Update AS Policy
- opentelekomcloud.cloud.as_policy:
    scaling_group: "as-group-test"
    scaling_policy: "collection-test"
    scaling_policy_type: "alarm"
    alarm: "as-alarm-test"
    scaling_policy_action:
      operation: "add"
      instance_number: 1
  register: as_policy
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Delete AS Policy
- opentelekomcloud.cloud.as_policy:
    scaling_group: "{{ as_group_name}}"
    scaling_policy: "{{ as_policy_name }}"
    state: "absent"
  register: as_policy

Inputs

    
auth:
    description:
    - Dictionary containing auth information as needed by the cloud's auth plugin strategy.
      For the default I(password) plugin, this would contain I(auth_url), I(username),
      I(password), I(project_name) and any information about domains (for example, I(os_user_domain_name)
      or I(os_project_domain_name)) if the cloud supports them. For other plugins, this
      param will need to contain whatever parameters that auth plugin requires. This parameter
      is not needed if a named cloud is provided or OpenStack OS_* environment variables
      are present.
    type: dict

wait:
    default: true
    description:
    - Should ansible wait until the requested resource is complete.
    type: bool

alarm:
    description:
    - Specifies the periodic or scheduled AS policy.
    - This parameter is mandatory when scaling_policy_type is set to ALARM.
    type: str

cloud:
    description:
    - Named cloud or cloud config to operate against. If I(cloud) is a string, it references
      a named cloud config as defined in an OpenStack clouds.yaml file. Provides default
      values for I(auth) and I(auth_type). This parameter is not needed if I(auth) is
      provided or if OpenStack OS_* environment variables are present. If I(cloud) is
      a dict, it contains a complete cloud configuration like would be in a section of
      clouds.yaml.
    type: raw

state:
    choices:
    - present
    - absent
    default: present
    description:
    - Whether resource should be present or absent.
    type: str

ca_cert:
    aliases:
    - cacert
    description:
    - A path to a CA Cert bundle that can be used as part of verifying SSL API requests.
    type: str

timeout:
    default: 180
    description:
    - How long should ansible wait for the requested resource.
    type: int

auth_type:
    description:
    - Name of the auth plugin to use. If the cloud uses something other than password
      authentication, the name of the plugin should be indicated here and the contents
      of the I(auth) parameter should be updated accordingly.
    type: str

interface:
    aliases:
    - endpoint_type
    choices:
    - admin
    - internal
    - public
    default: public
    description:
    - Endpoint URL type to fetch from the service catalog.
    type: str

client_key:
    aliases:
    - key
    description:
    - A path to a client key to use as part of the SSL transaction.
    type: str

api_timeout:
    description:
    - How long should the socket layer wait before timing out for API calls. If this is
      omitted, nothing will be passed to the requests library.
    type: int

client_cert:
    aliases:
    - cert
    description:
    - A path to a client certificate to use as part of the SSL transaction.
    type: str

region_name:
    description:
    - Name of the region.
    type: str

sdk_log_path:
    description:
    - Path to the logfile of the OpenStackSDK. If empty no log is written
    type: str

scaling_group:
    description:
    - Name or ID of the AS group.
    type: str

sdk_log_level:
    choices:
    - ERROR
    - WARN
    - INFO
    - DEBUG
    default: WARN
    description: Log level of the OpenStackSDK
    type: str

cool_down_time:
    default: 300
    description:
    - Specifies the cooldown period (in seconds).
    - The value ranges from 0 to 86400
    type: int

scaling_policy:
    description:
    - Specifies the AS policy name or ID.
    - Max name length is 64 characters.
    - Name can contains only letters, digits, underscores, hyphens
    required: true
    type: str

validate_certs:
    aliases:
    - verify
    description:
    - Whether or not SSL API requests should be verified.
    - Before Ansible 2.3 this defaulted to C(yes).
    type: bool

scheduled_policy:
    description:
    - Specifies the periodic or scheduled AS policy.
    - This parameter is mandatory when scaling_policy_type is set to      SCHEDULED or
      RECURRENCE.
    suboptions:
      end_time:
        description:
        - Specifies the end time of the scaling action triggered          periodically.
        - The end time cannot be earlier than the current and start time.
        - The time format complies with UTC.
        - The time format is YYYY-MM-DDThh:mmZ.
        type: str
      launch_time:
        description:
        - Specifies the time when the scaling action is triggered.
        - The time format complies with UTC.
        - If scaling_policy_type is set to SCHEDULED,          the time format is YYYY-MM-DDThh:mmZ.
        - If scaling_policy_type is set to RECURRENCE,          the time format is hh:mm.
        type: str
      recurrence_type:
        choices:
        - daily
        - weekly
        - monthly
        description:
        - Specifies the periodic triggering type.
        - This parameter is mandatory when scaling_policy_type          is set to RECURRENCE.
        type: str
      recurrence_value:
        description:
        - Specifies the day when a periodic scaling action is triggered.
        - This parameter is mandatory when scaling_policy_type is set          to RECURRENCE.
        - If recurrence_type is set to "Daily", the value is null,          indicating
          that the scaling action is triggered once a day.
        - If recurrence_type is set to Weekly, the value ranges from          1 (Sunday)
          to 7 (Saturday). The digits refer to dates in each          week and separated
          by a comma, such as 1,3,5.
        - If recurrence_type is set to Monthly, the value ranges          from 1 to 31.
          The digits refer to the dates in each month          and separated by a comma,
          such as 1,10,13,28.
        type: str
      start_time:
        description:
        - Specifies the start time of the scaling action triggered          periodically.
        - The time format complies with UTC.
        - The default value is the local time.
        - The time format is YYYY-MM-DDThh:mmZ.
        type: str
    type: dict

scaling_policy_type:
    choices:
    - alarm
    - scheduled
    - recurrence
    description:
    - Specifies the AS policy type
    type: str

scaling_policy_action:
    description:
    - Specifies the scaling action of the AS policy.
    suboptions:
      instance_number:
        default: 1
        description:
        - Specifies the number of instances to be operated.
        - The default number is 1.
        - Either instance_number or instance_percentage is required.
        - If operation is set to SET, the value range is 0 to 200.
        - If operation is set to ADD, REMOVE or REDUCE,          the value range is 1
          to 200.
        type: int
      instance_percentage:
        description:
        - Specifies the percentage of instances to be operated.
        - If operation is set to ADD, REMOVE or REDUCE,          the value of this parameter
          is an integer from 1 to 20000.
        - If operation is set to SET, the value is an integer          from 0 to 20000.
        - Either instance_number or instance_percentage is required.
        - If neither instance_number nor instance_percentage is specified,           the
          number of instances to be operated is 1.
        type: int
      operation:
        choices:
        - add
        - remove
        - reduce
        - set
        default: add
        description:
        - Specifies the operation to be performed.
        - The default operation is ADD.
        type: str
    type: dict

Outputs

as_policy:
  contains:
    scaling_policy_id:
      description: Specifies the AS policy ID.
      sample: 0h327883-324n-4dzd-9c61-68d03ee191dd
      type: str
  description: AS policy ID.
  returned: success
  type: complex