You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
# the backend needs to be DOWN
- name: Set backend statecommunity.general.haproxy:
state: disabledhost: "{{ _host }}"socket: /tmp/haproxy.admin.sockwait: truedrain: truewait_interval: 5wait_retries: 25become: 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
I agree to follow the Ansible Code of Conduct
The text was updated successfully, but these errors were encountered:
This could be fixed by changing plugins/modules/haproxy.py line 344 to: if state is not None and wait_for_status is not "DRAIN" and state is not "DOWN":
This could be fixed by changing plugins/modules/haproxy.py line 344 to: if state is not None and wait_for_status is not "DRAIN" and state is not "DOWN":
I moved my fix two lines down. This ensures that the backend is still set to DRAIN and only the wait is skipped. If the backend is set to DRAIN and the server is unreachable, it will remain in the DOWN state. However, if it comes back up during this time, it will switch to DRAIN. Otherwise, it would go back to UP in the worst case.
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
Community.general Version
Configuration
$ ansible-config dump --only-changed
OS / Environment
testet on RHEL 7 - 9
Steps to Reproduce
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
The text was updated successfully, but these errors were encountered: