tripleo_container_rm: also remove systemd requires when they exist

Containers managed by systemd might have some .requires files for their
healthchecks. Make sure we also cleanup these files.

Change-Id: I576f5077dd82ac96290d56603dcbb70347366d65
This commit is contained in:
Emilien Macchi 2020-02-20 20:59:19 -05:00
parent f3729699ff
commit edc8fa1cda
1 changed files with 13 additions and 1 deletions

View File

@ -60,9 +60,21 @@
path: "/etc/systemd/system/tripleo_{{ container }}.service"
state: absent
- name: "check if {{ container }} service requires exists in systemd"
stat:
path: "/etc/systemd/system/tripleo_{{ container }}.service.requires"
register: systemd_requires_exists
- name: "remove {{ container }} systemd requires"
file:
path: "/etc/systemd/system/tripleo_{{ container }}.service.requires"
state: absent
when:
- systemd_requires_exists.stat.exists
- name: Reload systemd services if needed
when:
- systemd_healthcheck_exists.stat.exists or systemd_exists.stat.exists
- systemd_healthcheck_exists.stat.exists or systemd_exists.stat.exists or systemd_requires_exists.stat.exists
systemd:
daemon_reload: true