community.general
community.general copied to clipboard
Module haproxy times out instead setting HAProxy backends into DRAIN mode followed by MAINT when the Backend is down / unreachable
Summary
This is a similar bug to: https://github.com/ansible-collections/community.general
HAProxy allows setting backends into DRAIN mode, which waits until the server has no active connections before transitioning them into MAINT mode.
The corresponding Ansible haproxy module offers a state and parameter named 'drain' to achieve this functionality.
However, if the backend is unreachable and thus in a failed state, the haproxy module times out and fails instead of entering MAINT mode. The expected behavior would be to either directly fail or bypass the DRAIN mode and enter MAINT immediately.
Additionally, I noticed that "drain: true" does not work properly unless "wait: true" is also specified. Therefore, "wait: true" should be a mandatory parameter when using "drain: true".
I would appreciate it if this issue could be investigated and fixed.
Thank you for your time and consideration.
Issue Type
Bug Report
Component Name
haproxy
Ansible Version
$ ansible --version
ansible [core 2.16.4]
config file = /home/user/stuff/ansible/ansible.cfg
configured module search path = ['/home/user/stuff/ansible/plugins/library']
ansible python module location = /usr/lib/python3.12/site-packages/ansible
ansible collection location = /home/user/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.12.2 (main, Feb 21 2024, 00:00:00) [GCC 13.2.1 20231205 (Red Hat 13.2.1-6)] (/usr/bin/python3)
jinja version = 3.1.3
libyaml = True
Community.general Version
$ ansible-galaxy collection list community.general
# /home/user/.ansible/collections/ansible_collections
Collection Version
----------------- -------
community.general 5.6.0
# /usr/lib/python3.12/site-packages/ansible_collections
Collection Version
----------------- -------
community.general 8.4.0
Configuration
$ ansible-config dump --only-changed
OS / Environment
testet on RHEL 7 - 9
Steps to Reproduce
# the backend needs to be DOWN
- name: Set backend state
community.general.haproxy:
state: disabled
host: "{{ _host }}"
socket: /tmp/haproxy.admin.sock
wait: true
drain: true
wait_interval: 5
wait_retries: 25
become: true
Expected Results
The expected behavior would be to either directly fail or bypass the DRAIN mode and enter MAINT immediately.
Actual Results
Code of Conduct
- [X] I agree to follow the Ansible Code of Conduct