From 3123166b075d36cd6e546781f003c45ff0c13d58 Mon Sep 17 00:00:00 2001 From: Boris Ranto Date: Fri, 6 Oct 2017 12:00:25 +0200 Subject: [PATCH] ansible: Fix merge_vars.yml Currently, we override the variables in merge_vars. However, if we run the script several times (e.g. a host is a grafana and a collectd node) then vars[item] is defined but it can be that it is not a mapping. In this case we redefine the value to empty string breaking the actual values of the variables. We redefine e.g. devel_mode or use_epel to empty string this way making it false for the grafana server node that is both grafana and the collectd node. Signed-off-by: Boris Ranto --- ansible/roles/cephmetrics-common/tasks/merge_vars.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/roles/cephmetrics-common/tasks/merge_vars.yml b/ansible/roles/cephmetrics-common/tasks/merge_vars.yml index 649ebf1..f8dbcd0 100644 --- a/ansible/roles/cephmetrics-common/tasks/merge_vars.yml +++ b/ansible/roles/cephmetrics-common/tasks/merge_vars.yml @@ -1,5 +1,5 @@ --- - name: Combine default settings and user-defined variables - set_fact: {"{{ item }}": "{% if vars[item] is not defined %}{{ defaults[item] }}{% endif %}{% if vars[item] is mapping %}{{ defaults[item]|combine(vars[item]|default({})) }}{% endif %}"} + set_fact: {"{{ item }}": "{% if vars[item] is not defined %}{{ defaults[item] }}{% elif vars[item] is mapping %}{{ defaults[item]|combine(vars[item]|default({})) }}{% else %}{{ vars[item] }}{% endif %}"} with_items: "{{ defaults.keys() }}" no_log: true -- 2.47.3