From 9b50eb10880d77fbf69d44431a3dc7746269767c Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Tue, 23 Jan 2024 11:37:08 +0100 Subject: [PATCH] Allow to gracefully drain backends when disabled This adds required parameters to the playbook to drain existing connections towards backends instead of forcefully closing connections. Change-Id: Iad35b654e0cec1b9e4083ef547822feecdf917b6 --- ansible_tools/playbooks/set-haproxy-backends-state.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ansible_tools/playbooks/set-haproxy-backends-state.yml b/ansible_tools/playbooks/set-haproxy-backends-state.yml index 9133cd9d..04e81d24 100644 --- a/ansible_tools/playbooks/set-haproxy-backends-state.yml +++ b/ansible_tools/playbooks/set-haproxy-backends-state.yml @@ -34,4 +34,9 @@ host: "{{ item }}" state: "{{ backend_state }}" socket: /var/run/haproxy.stat + drain: "{{ haproxy_drain | default(False) }}" + shutdown_sessions: "False" + wait: "True" + wait_interval: "{{ haproxy_wait_interval | default(5) }}" + wait_retries: "{{ haproxy_wait_retries | default(24) }}" with_items: "{{ backends.stdout_lines }}"