db4a5dbca2
Now that Podman natively supports healthchecks, let's use them; which will reduce our footprint in how we consume Podman. Using native healthcheck brings a few benefits: - Less Ansible tasks to manage the systemd resources, so deployment should be slightly faster. - Leverage features into the container tooling directly; not in tripleo. This patch does the following: - Fix the podman arguments for healthcheck options in podman_container module, transparent for the end-user. Indeed, the args are "health-*". - Remove the management of timers and healthcheck services and their requires. - New playbook "healthcheck_cleanup" to cleanup previous systemd healthchecks if they exist. - Update molecule default testing to test if new healthchecks work fine. - Update the role manual for healthchecks usage. This patch should be transparent for the end-users except that the systemd healthchecks won't exist anymore: Instead of running: "systemctl status tripleo_keystone_healthcheck.timer status", we would run "podman healthcheck run keystone" or check the output of "podman inspect keystone". The document has also been updated in the role manual. It requires at least Podman 1.6 where this patch has been tested. Depends-On: https://review.opendev.org/720089 Change-Id: I37508cd8243999389f9e17d5ea354529bb042279
49 lines
1.9 KiB
YAML
49 lines
1.9 KiB
YAML
---
|
|
# Copyright 2020 Red Hat, Inc.
|
|
# All Rights Reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
- name: "Stop and disable systemd timer for {{ container_systemd_healthcheck_name }}"
|
|
systemd:
|
|
state: stopped
|
|
name: "tripleo_{{ container_systemd_healthcheck_name }}_healthcheck.timer"
|
|
enabled: false
|
|
daemon_reload: false
|
|
|
|
- name: "Remove systemd healthcheck files for {{ container_systemd_healthcheck_name }}"
|
|
file:
|
|
path: "{{ container_systemd_healthcheck_file }}"
|
|
state: absent
|
|
loop:
|
|
- "/etc/systemd/system/tripleo_{{ container_systemd_healthcheck_name }}_healthcheck.service"
|
|
- "/etc/systemd/system/tripleo_{{ container_systemd_healthcheck_name }}_healthcheck.timer"
|
|
loop_control:
|
|
loop_var: container_systemd_healthcheck_file
|
|
|
|
- name: Force systemd to re-read config after healthcheck removals
|
|
systemd:
|
|
daemon_reload: true
|
|
|
|
- name: "Check if {{ container_systemd_healthcheck_name }} healthcheck is not running"
|
|
command: "systemctl is-active --quiet tripleo_{{ container_systemd_healthcheck_name }}_healthcheck.timer"
|
|
register: tripleo_healthcheck_result
|
|
failed_when:
|
|
- tripleo_healthcheck_result.rc == 0
|
|
|
|
- name: "Check if {{ container_systemd_healthcheck_name }} service is running and healthy"
|
|
command: "systemctl is-active --quiet tripleo_{{ container_systemd_healthcheck_name }}.service"
|
|
register: tripleo_service_result
|
|
failed_when:
|
|
- tripleo_service_result.rc != 0
|