diff --git a/playbooks/roles/haproxy/handlers/hup_haproxy.yaml b/playbooks/roles/haproxy/handlers/hup_haproxy.yaml new file mode 100644 index 0000000000..cb14d72441 --- /dev/null +++ b/playbooks/roles/haproxy/handlers/hup_haproxy.yaml @@ -0,0 +1,22 @@ +# This is necessary because podman kill -s HUP doesn't currently work on +# Ubuntu Noble. They appear tohave fixed this for other common signals (see +# https://bugs.launchpad.net/ubuntu/+source/libpod/+bug/2040483 ) but not +# for HUP. To work around this we use kill directly against the container +# process. +# +# Note that we need the first docker-compose ps here as the container name +# is different between docker-compose and docker compose. +- name: Get haproxy container ID + command: docker-compose ps -q haproxy + args: + chdir: /etc/haproxy-docker/ + register: docker_ps + +- name: Get haproxy container pid + command: "{{ cmd_str }} {{ docker_ps.stdout }}" + vars: + cmd_str: !unsafe "docker inspect --format '{{ .State.Pid }}'" + register: docker_inspect + +- name: Send HUP to haproxy + command: kill -s HUP {{ docker_inspect.stdout }} diff --git a/playbooks/roles/haproxy/handlers/main.yaml b/playbooks/roles/haproxy/handlers/main.yaml index 9d749458e7..2db10d95cf 100644 --- a/playbooks/roles/haproxy/handlers/main.yaml +++ b/playbooks/roles/haproxy/handlers/main.yaml @@ -1,4 +1,2 @@ - name: Reload haproxy - shell: - cmd: docker-compose kill -s HUP haproxy - chdir: /etc/haproxy-docker/ + include_tasks: roles/haproxy/handlers/hup_haproxy.yaml