community.general.apache2_mod_proxy module – Set and/or get members’ attributes of an Apache httpd 2.4 mod_proxy balancer pool
Note
This module is part of the community.general collection (version 10.7.5).
You might already have this collection installed if you are using the ansible package.
It is not included in ansible-core.
To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install community.general.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: community.general.apache2_mod_proxy.
Synopsis
- Set and/or get members’ attributes of an Apache httpd 2.4 mod_proxy balancer pool, using HTTP POST and GET requests. The httpd mod_proxy balancer-member status page has to be enabled and accessible, as this module relies on parsing this page. 
Requirements
The below requirements are needed on the host that executes this module.
- Python package - BeautifulSoupon Python 2,- beautifulsoup4on Python 3.
Parameters
| Parameter | Comments | 
|---|---|
| Suffix of the balancer pool URL required to access the balancer pool status page (for example  Default:  | |
| (IPv4|IPv6|FQDN):port of the Apache httpd 2.4 mod_proxy balancer pool. | |
| (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, the community.general.apache2_mod_proxy module returns a members list of dictionaries of all the current balancer pool members’ attributes. | |
| Desired state of the member host. States can be simultaneously invoked by separating them with a comma (for example  States  Choices: 
 | |
| Use https to access balancer management page. Choices: 
 | |
| Validate ssl/tls certificates. Choices: 
 | 
Attributes
| Attribute | Support | Description | 
|---|---|---|
| Support: full | Can run in  | |
| Support: none | Will return details on what has changed (or possibly needs changing in  | 
Examples
- name: Get all current balancer pool members attributes
  community.general.apache2_mod_proxy:
    balancer_vhost: 10.0.0.2
- name: Get a specific member attributes
  community.general.apache2_mod_proxy:
    balancer_vhost: myws.mydomain.org
    balancer_suffix: /lb/
    member_host: node1.myws.mydomain.org
# Enable all balancer pool members:
- name: Get attributes
  community.general.apache2_mod_proxy:
    balancer_vhost: '{{ myloadbalancer_host }}'
  register: result
- name: Enable all balancer pool members
  community.general.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:
- name: Step 1
  community.general.apache2_mod_proxy:
    balancer_vhost: '{{ vhost_host }}'
    member_host: '{{ member.host }}'
    state: drained
  delegate_to: myloadbalancernode
- name: Step 2
  ansible.builtin.wait_for:
    host: '{{ member.host }}'
    port: '{{ member.port }}'
    state: drained
  delegate_to: myloadbalancernode
- name: Step 3
  community.general.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 | Description | 
|---|---|
| Specific balancer member information dictionary, returned when the module is invoked with  Returned: success Sample:  | |
| List of member (defined above) dictionaries, returned when the module is invoked with no  Returned: success Sample:  | 
