From 688201330996dd7cfb14e8f3b5a1348cb5cb7867 Mon Sep 17 00:00:00 2001
From: Mark Goddard <mark@stackhpc.com>
Date: Wed, 2 Sep 2020 09:27:14 +0100
Subject: [PATCH] Fix common role when using external mariadb

If the common role is executed against a set of hosts that are not all
in the fluentd group, the run_once tasks that find customisations may be
skipped. This causes a later failure when accessing the registered
variables for those tasks.

This issue was raised on the mailing list:
http://lists.openstack.org/pipermail/openstack-discuss/2020-September/016932.html

This issue only affects the master branch, due to addition of groups
for the common role in I6a4676bf6efeebc61383ec7a406db07c7a868b2a.

This change fixes the issue by always running the find tasks, if fluentd
is enabled.

Change-Id: I559c4b94d18c7f36d43e1d88629ed44668abf859
---
 ansible/roles/common/tasks/config.yml | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/ansible/roles/common/tasks/config.yml b/ansible/roles/common/tasks/config.yml
index 0a0125578d..ff31d13fd3 100644
--- a/ansible/roles/common/tasks/config.yml
+++ b/ansible/roles/common/tasks/config.yml
@@ -72,7 +72,7 @@
   run_once: True
   register: find_custom_fluentd_inputs
   delegate_to: localhost
-  when: common_services.fluentd | service_enabled_and_mapped_to_host
+  when: common_services.fluentd.enabled | bool
 
 - name: Find custom fluentd filter config files
   find:
@@ -81,7 +81,7 @@
   run_once: True
   register: find_custom_fluentd_filters
   delegate_to: localhost
-  when: common_services.fluentd | service_enabled_and_mapped_to_host
+  when: common_services.fluentd.enabled | bool
 
 - name: Find custom fluentd format config files
   find:
@@ -90,8 +90,7 @@
   run_once: True
   register: find_custom_fluentd_formats
   delegate_to: localhost
-  when:
-    - common_services.fluentd | service_enabled_and_mapped_to_host
+  when: common_services.fluentd.enabled | bool
 
 - name: Find custom fluentd output config files
   find:
@@ -100,8 +99,7 @@
   run_once: True
   register: find_custom_fluentd_outputs
   delegate_to: localhost
-  when:
-    - common_services.fluentd | service_enabled_and_mapped_to_host
+  when: common_services.fluentd.enabled | bool
 
 - name: Copying over td-agent.conf
   vars:
-- 
GitLab