diff --git a/ansible/roles/rabbitmq/defaults/main.yml b/ansible/roles/rabbitmq/defaults/main.yml index 1d93ca5491..22d9ebc397 100644 --- a/ansible/roles/rabbitmq/defaults/main.yml +++ b/ansible/roles/rabbitmq/defaults/main.yml @@ -18,6 +18,7 @@ rabbitmq_services: RABBITMQ_LOG_DIR: "/var/log/kolla/{{ project_name }}" volumes: "{{ rabbitmq_default_volumes + rabbitmq_extra_volumes }}" dimensions: "{{ rabbitmq_dimensions }}" + healthcheck: "{{ rabbitmq_healthcheck }}" haproxy: rabbitmq_management: enabled: "{{ enable_rabbitmq }}" @@ -56,6 +57,19 @@ rabbitmq_tag: "{{ openstack_tag }}" rabbitmq_image_full: "{{ rabbitmq_image }}:{{ rabbitmq_tag }}" rabbitmq_dimensions: "{{ default_container_dimensions }}" +rabbitmq_enable_healthchecks: "{{ enable_container_healthchecks }}" +rabbitmq_healthcheck_interval: "{{ default_container_healthcheck_interval }}" +rabbitmq_healthcheck_retries: "{{ default_container_healthcheck_retries }}" +rabbitmq_healthcheck_start_period: "{{ default_container_healthcheck_start_period }}" +rabbitmq_healthcheck_test: ["CMD-SHELL", "healthcheck_rabbitmq"] +rabbitmq_healthcheck_timeout: "{{ default_container_healthcheck_timeout }}" +rabbitmq_healthcheck: + interval: "{{ rabbitmq_healthcheck_interval }}" + retries: "{{ rabbitmq_healthcheck_retries }}" + start_period: "{{ rabbitmq_healthcheck_start_period }}" + test: "{% if rabbitmq_enable_healthchecks | bool %}{{ rabbitmq_healthcheck_test }}{% else %}NONE{% endif %}" + timeout: "{{ rabbitmq_healthcheck_timeout }}" + rabbitmq_default_volumes: - "{{ node_config_directory }}/{{ project_name }}/:{{ container_config_directory }}/:ro" - "/etc/localtime:/etc/localtime:ro" diff --git a/ansible/roles/rabbitmq/tasks/check-containers.yml b/ansible/roles/rabbitmq/tasks/check-containers.yml index 0ff847b49f..72cbb2ba6b 100644 --- a/ansible/roles/rabbitmq/tasks/check-containers.yml +++ b/ansible/roles/rabbitmq/tasks/check-containers.yml @@ -9,6 +9,7 @@ volumes: "{{ item.value.volumes }}" environment: "{{ item.value.environment }}" dimensions: "{{ item.value.dimensions }}" + healthcheck: "{{ item.value.healthcheck | default(omit) }}" when: - inventory_hostname in groups[item.value.group] - item.value.enabled | bool diff --git a/ansible/roles/rabbitmq/tasks/restart_services.yml b/ansible/roles/rabbitmq/tasks/restart_services.yml index d981dfe111..b2cf58773b 100644 --- a/ansible/roles/rabbitmq/tasks/restart_services.yml +++ b/ansible/roles/rabbitmq/tasks/restart_services.yml @@ -12,6 +12,7 @@ volumes: "{{ service.volumes }}" environment: "{{ service.environment }}" dimensions: "{{ service.dimensions }}" + healthcheck: "{{ service.healthcheck | default(omit) }}" - name: Waiting for rabbitmq to start vars: diff --git a/releasenotes/notes/implement-docker-healthchecks-for-rabbitmq-a596f6b063026491.yaml b/releasenotes/notes/implement-docker-healthchecks-for-rabbitmq-a596f6b063026491.yaml new file mode 100644 index 0000000000..393bfd68ec --- /dev/null +++ b/releasenotes/notes/implement-docker-healthchecks-for-rabbitmq-a596f6b063026491.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + Implements container healthchecks for rabbitmq services. + See `blueprint + `__