Merge "Revert "Adjust HAProxy script to allow for ID change""

This commit is contained in:
Zuul 2021-09-22 16:27:54 +00:00 committed by Gerrit Code Review
commit 8a77ef118c
1 changed files with 6 additions and 7 deletions

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') }}"