From aa28675ca914f5f27be0ba654fe2de13f4617ff1 Mon Sep 17 00:00:00 2001
From: Mark Goddard <mark@stackhpc.com>
Date: Wed, 21 Jul 2021 10:02:35 +0100
Subject: [PATCH] Fix ironic_ipxe healthcheck on Debian/Ubuntu

The healthcheck checks for a process called httpd, but these distros
call it apache2.  This results in the ironic_ipxe container being marked
as unhealthy.

This change fixes the issue by making the process name distro dependent.

Change-Id: I0b0126e3071146e7f8593ba970ecbed65b36fcfa
Closes-Bug: #1937037
---
 ansible/roles/ironic/defaults/main.yml                      | 2 +-
 .../fix-deb-ironic-ipxe-heathcheck-2ae5fd0537c056ce.yaml    | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)
 create mode 100644 releasenotes/notes/fix-deb-ironic-ipxe-heathcheck-2ae5fd0537c056ce.yaml

diff --git a/ansible/roles/ironic/defaults/main.yml b/ansible/roles/ironic/defaults/main.yml
index 3f2e99abac..a2ba1ce644 100644
--- a/ansible/roles/ironic/defaults/main.yml
+++ b/ansible/roles/ironic/defaults/main.yml
@@ -170,7 +170,7 @@ ironic_ipxe_enable_healthchecks: "{{ enable_container_healthchecks }}"
 ironic_ipxe_healthcheck_interval: "{{ default_container_healthcheck_interval }}"
 ironic_ipxe_healthcheck_retries: "{{ default_container_healthcheck_retries }}"
 ironic_ipxe_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}"
-ironic_ipxe_healthcheck_test: ["CMD-SHELL", "healthcheck_listen httpd {{ ironic_ipxe_port }}"]
+ironic_ipxe_healthcheck_test: ["CMD-SHELL", "healthcheck_listen {% if kolla_base_distro in ['debian', 'ubuntu'] %}apache2{% else %}httpd{% endif %} {{ ironic_ipxe_port }}"]
 ironic_ipxe_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}"
 ironic_ipxe_healthcheck:
   interval: "{{ ironic_ipxe_healthcheck_interval }}"
diff --git a/releasenotes/notes/fix-deb-ironic-ipxe-heathcheck-2ae5fd0537c056ce.yaml b/releasenotes/notes/fix-deb-ironic-ipxe-heathcheck-2ae5fd0537c056ce.yaml
new file mode 100644
index 0000000000..e296b10804
--- /dev/null
+++ b/releasenotes/notes/fix-deb-ironic-ipxe-heathcheck-2ae5fd0537c056ce.yaml
@@ -0,0 +1,6 @@
+---
+fixes:
+  - |
+    Fixes the container health check for the ``ironic_ipxe`` container on
+    Debian and Ubuntu systems. `LP#1937037
+    <https://bugs.launchpad.net/kolla-ansible/+bug/1937037>`__