Documentation

ali_slb_server_facts - Gather facts on backend server of Alibaba Cloud SLB.

New in version 1.5.0.

Synopsis

  • This module fetches data from the Open API in Alicloud. The module must be called from within the SLB backend server itself.

Requirements

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

  • footmark
  • 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
listener_ports
A list of backend server listening ports.

aliases: ports
load_balancer_id
required
ID of server load balancer.

aliases: lb_id

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

# Fetch backend server health status details according to setting different filters
- name: fetch backend server health status in the specified region
  hosts: localhost
  connection: local
  vars:
    alicloud_access_key: <your-alicloud-access-key-id>
    alicloud_secret_key: <your-alicloud-access-secret-key>
    alicloud_region: cn-beijing
    load_balancer_id: lb-dj1e5kwh41n87vkn1pxn5
    ports:
      - 100
      - 90
  tasks:
    - name: Find all backend server health status in specified region
      ali_slb_server_facts:
        alicloud_access_key: '{{ alicloud_access_key }}'
        alicloud_secret_key: '{{ alicloud_secret_key }}'
        alicloud_region: '{{ alicloud_region }}'
        load_balancer_id: '{{ load_balancer_id }}'
      register: all_backend_server
    - debug: var=all_backend_server

    - name: Find all backend server health status based on specified port no.
      ali_slb_server_facts:
        alicloud_access_key: '{{ alicloud_access_key }}'
        alicloud_secret_key: '{{ alicloud_secret_key }}'
        alicloud_region: '{{ alicloud_region }}'
        load_balancer_id: '{{ load_balancer_id }}'
        listener_ports: '{{ ports }}'
      register: backend_servera_by_ports
    - debug: var=backend_servera_by_ports

Return Values

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

Key Returned Description
backend_servers
list
when success
Details about the backened-servers that were added.

Sample:
[{'id': 'i-2ze35dldjc05dcvezgwk', 'listener_port': 80, 'port': 80, 'server_health_status': 'unavailable'}, {'id': 'i-2ze35dldjc05dcvezgwk', 'listener_port': 8080, 'port': 8080, 'server_health_status': 'unavailable'}, {'id': 'i-2ze35dldjc05dcvezgwk', 'listener_port': 8085, 'port': 8085, 'server_health_status': 'unavailable'}]
load_balancer_id
string
when success
ID of the load balancer.

Sample:
lb-dj1jywbux1zslfna6pvnv


Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Author

  • He Guimin (@xiaozhu36)

Hint

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