Revert "Adjust HAProxy script to allow for ID change"

The taken approach adds an unnecessary reloading of the just started
container, therefore a revert proposed.

Related-bug: #1940729
This reverts commit a22ef3a0bc.

Change-Id: I47f2b0a6764218314a617bb224f599f2c567730c
This commit is contained in:
Bogdan Dobrelya 2021-09-01 17:59:26 +02:00
parent 151ca15e81
commit 835c6a04bc

View File

@ -175,16 +175,15 @@ outputs:
- name: copy certificate, chgrp, restart haproxy
shell: |
set -e
container_id=$({{ container_cli }} ps --filter name=haproxy-bundle -q)
if [[ "x$container_id" ! = "x" ]]; then
tar -c {{ cert_path }} | {{ container_cli }} exec -i $container_id tar -C / -xv
if {{ container_cli }} ps -f "id={{ item }}" --format "{{ '{{' }}.Names{{ '}}' }}" | grep -q "^haproxy-bundle"; then
tar -c {{ cert_path }} | {{container_cli}} exec -i {{ item }} tar -C / -xv
else
{{ container_cli }} cp {{ cert_path }} {{ item }}:{{ cert_path }}
fi
{{ container_cli }} exec --user root $container_id chgrp haproxy {{ cert_path }}
{{ container_cli }} kill --signal=HUP $container_id
{{ container_cli }} exec --user root {{ item }} chgrp haproxy {{ cert_path }}
{{ container_cli }} kill --signal=HUP {{ item }}
register: container_kill_result
failed_when:
- ("no such container" in container_kill_result.stderr)
- ("container state improper" in container_kill_result.stderr)
- ("no such container" not in container_kill_result.stderr)
- ("container state improper" not in container_kill_result.stderr)
with_items: "{{ container_id.stdout.split('\n') }}"