Note
This plugin is part of the community.general collection (version 3.8.1).
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
.
To use it in a playbook, specify: community.general.apache2_mod_proxy
.
Parameter | Choices/Defaults | Comments |
---|---|---|
balancer_url_suffix string | 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 string / required | (ipv4|ipv6|fqdn):port of the Apache httpd 2.4 mod_proxy balancer pool. | |
member_host string | (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 string | 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). Accepted state values: ["present", "absent", "enabled", "disabled", "drained", "hot_standby", "ignore_errors"] | |
tls boolean |
| Use https to access balancer management page. |
validate_certs boolean |
| Validate ssl/tls certificates. |
- 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
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
member dictionary | success | specific balancer member information dictionary, returned when apache2_mod_proxy module is invoked with member_host parameter. Sample: {'attributes': {'Busy': '0', 'Elected': '42', 'Factor': '1', 'From': '136K', 'Load': '0', 'Route': None, 'RouteRedir': None, 'Set': '0', 'Status': 'Init Ok ', 'To': ' 47K', 'Worker URL': None}, 'balancer_url': 'http://10.10.0.2/balancer-manager/', 'host': '10.10.0.20', 'management_url': 'http://10.10.0.2/lb/?b=mywsbalancer&w=http://10.10.0.20:8080/ws&nonce=8925436c-79c6-4841-8936-e7d13b79239b', 'path': '/ws', 'port': 8080, 'protocol': 'http', 'status': {'disabled': False, 'drained': False, 'hot_standby': False, 'ignore_errors': False}} |
members list / elements=string | success | list of member (defined above) dictionaries, returned when apache2_mod_proxy is invoked with no member_host and state args. Sample: [{'attributes': {'Busy': '0', 'Elected': '42', 'Factor': '1', 'From': '136K', 'Load': '0', 'Route': None, 'RouteRedir': None, 'Set': '0', 'Status': 'Init Ok ', 'To': ' 47K', 'Worker URL': None}, 'balancer_url': 'http://10.10.0.2/balancer-manager/', 'host': '10.10.0.20', 'management_url': 'http://10.10.0.2/lb/?b=mywsbalancer&w=http://10.10.0.20:8080/ws&nonce=8925436c-79c6-4841-8936-e7d13b79239b', 'path': '/ws', 'port': 8080, 'protocol': 'http', 'status': {'disabled': False, 'drained': False, 'hot_standby': False, 'ignore_errors': False}}, {'attributes': {'Busy': '0', 'Elected': '42', 'Factor': '1', 'From': '136K', 'Load': '0', 'Route': None, 'RouteRedir': None, 'Set': '0', 'Status': 'Init Ok ', 'To': ' 47K', 'Worker URL': None}, 'balancer_url': 'http://10.10.0.2/balancer-manager/', 'host': '10.10.0.21', 'management_url': 'http://10.10.0.2/lb/?b=mywsbalancer&w=http://10.10.0.21:8080/ws&nonce=8925436c-79c6-4841-8936-e7d13b79239b', 'path': '/ws', 'port': 8080, 'protocol': 'http', 'status': {'disabled': False, 'drained': False, 'hot_standby': False, 'ignore_errors': False}}] |
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/general/apache2_mod_proxy_module.html