apache2_mod_proxy - Set and/or get members’ attributes of an Apache httpd 2.4 mod_proxy balancer pool

New in version 2.2.

Synopsis

Parameters

Parameter Choices/Defaults Comments
balancer_url_suffix Default:
/balancer-manager/
Suffix of the balancer pool url required to access the balancer pool status page (e.g. balancer_vhost[:port]/balancer_url_suffix).
balancer_vhost
required
(ipv4|ipv6|fqdn):port of the Apache httpd 2.4 mod_proxy balancer pool.
member_host
(ipv4|ipv6|fqdn) of the balancer member to get or to set attributes to. Port number is autodetected and should not be specified here. If undefined, apache2_mod_proxy module will return a members list of dictionaries of all the current balancer pool members' attributes.
state
    Choices:
  • present
  • absent
  • enabled
  • disabled
  • drained
  • hot_standby
  • ignore_errors
Desired state of the member host. (absent|disabled),drained,hot_standby,ignore_errors can be simultaneously invoked by separating them with a comma (e.g. state=drained,ignore_errors).
tls
bool
    Choices:
  • no ←
  • yes
Use https to access balancer management page.
validate_certs
bool
    Choices:
  • no
  • yes ←
Validate ssl/tls certificates.

Examples

# Get all current balancer pool members' attributes:
- apache2_mod_proxy:
    balancer_vhost: 10.0.0.2

# Get a specific member's attributes:
- apache2_mod_proxy:
    balancer_vhost: myws.mydomain.org
    balancer_suffix: /lb/
    member_host: node1.myws.mydomain.org

# Enable all balancer pool members:
- apache2_mod_proxy:
    balancer_vhost: '{{ myloadbalancer_host }}'
  register: result
- apache2_mod_proxy:
    balancer_vhost: '{{ myloadbalancer_host }}'
    member_host: '{{ item.host }}'
    state: present
  with_items: '{{ result.members }}'

# Gracefully disable a member from a loadbalancer node:
- apache2_mod_proxy:
    balancer_vhost: '{{ vhost_host }}'
    member_host: '{{ member.host }}'
    state: drained
  delegate_to: myloadbalancernode
- wait_for:
    host: '{{ member.host }}'
    port: '{{ member.port }}'
    state: drained
  delegate_to: myloadbalancernode
- apache2_mod_proxy:
    balancer_vhost: '{{ vhost_host }}'
    member_host: '{{ member.host }}'
    state: absent
  delegate_to: myloadbalancernode

Return Values

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

Key Returned Description
member
dict
success
specific balancer member information dictionary, returned when apache2_mod_proxy module is invoked with member_host parameter.

Sample:
{'status': {'disabled': False, 'hot_standby': False, 'drained': False, 'ignore_errors': False}, 'protocol': 'http', 'management_url': 'http://10.10.0.2/lb/?b=mywsbalancer&w=http://10.10.0.20:8080/ws&nonce=8925436c-79c6-4841-8936-e7d13b79239b', 'balancer_url': 'http://10.10.0.2/balancer-manager/', 'host': '10.10.0.20', 'attributes': {'Load': '0', 'Status': 'Init Ok ', 'Busy': '0', 'From': '136K', 'Elected': '42', 'Route': None, 'To': ' 47K', 'Set': '0', 'Factor': '1', 'Worker URL': None, 'RouteRedir': None}, 'path': '/ws', 'port': 8080}
members
list
success
list of member (defined above) dictionaries, returned when apache2_mod_proxy is invoked with no member_host and state args.

Sample:
[{'status': {'disabled': False, 'hot_standby': False, 'drained': False, 'ignore_errors': False}, 'protocol': 'http', 'management_url': 'http://10.10.0.2/lb/?b=mywsbalancer&w=http://10.10.0.20:8080/ws&nonce=8925436c-79c6-4841-8936-e7d13b79239b', 'balancer_url': 'http://10.10.0.2/balancer-manager/', 'host': '10.10.0.20', 'attributes': {'Load': '0', 'Status': 'Init Ok ', 'Busy': '0', 'From': '136K', 'Elected': '42', 'Route': None, 'To': ' 47K', 'Set': '0', 'Factor': '1', 'Worker URL': None, 'RouteRedir': None}, 'path': '/ws', 'port': 8080}, {'status': {'disabled': False, 'hot_standby': False, 'drained': False, 'ignore_errors': False}, 'protocol': 'http', 'management_url': 'http://10.10.0.2/lb/?b=mywsbalancer&w=http://10.10.0.21:8080/ws&nonce=8925436c-79c6-4841-8936-e7d13b79239b', 'balancer_url': 'http://10.10.0.2/balancer-manager/', 'host': '10.10.0.21', 'attributes': {'Load': '0', 'Status': 'Init Ok ', 'Busy': '0', 'From': '136K', 'Elected': '42', 'Route': None, 'To': ' 47K', 'Set': '0', 'Factor': '1', 'Worker URL': None, 'RouteRedir': None}, 'path': '/ws', 'port': 8080}]


Status

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

Maintenance

This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.

For a list of other modules that are also maintained by the Ansible Community, see here.

Author

  • Olivier Boukili (@oboukili)”

Hint

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