Add pre stop exec hook for container systemd units

Sometimes, actions taken as the part of a container's entrypoint script
should become the pre-stop actions. Allow such configurations composed
for managed containers.

Change-Id: I40237e2b35ce83c5b519a117a6d4e74cb845b2c3
Related-bug: #1884048
Signed-off-by: Bogdan Dobrelya <bdobreli@redhat.com>
changes/24/736524/1
Bogdan Dobrelya 2 years ago
parent 19ef86c627
commit 26abebb293
  1. 3
      tripleo_ansible/roles/tripleo_container_manage/templates/systemd-service.j2

@ -10,6 +10,9 @@ ExecStart=/usr/libexec/tripleo-start-podman-container {{ lookup('dict', containe
ExecStart=/usr/bin/podman start {{ lookup('dict', container_data_unit).key }}
{% endif %}
ExecReload=/usr/bin/podman kill --signal HUP {{ lookup('dict', container_data_unit).key }}
{% if lookup('dict', container_data_unit).value.pre_stop_exec is defined %}
ExecStop=-/usr/bin/podman exec {{ lookup('dict', container_data_unit).key }} {{ lookup('dict', container_data_unit).value.pre_stop_exec }}
{% endif %}
ExecStop=/usr/bin/podman stop -t {{ lookup('dict', container_data_unit).value.stop_grace_period | default(10) | int }} {{ lookup('dict', container_data_unit).key }}
KillMode=none
Type=forking

Loading…
Cancel
Save