]> git-server-git.apps.pok.os.sepia.ceph.com Git - cephmetrics.git/commitdiff
ansible: Fix merge_vars.yml
authorBoris Ranto <branto@redhat.com>
Fri, 6 Oct 2017 10:00:25 +0000 (12:00 +0200)
committerBoris Ranto <branto@redhat.com>
Fri, 6 Oct 2017 10:00:29 +0000 (12:00 +0200)
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 <branto@redhat.com>
ansible/roles/cephmetrics-common/tasks/merge_vars.yml

index 649ebf19e073319ce12cfd73e69f3e8d7f1c66eb..f8dbcd0abaaeafc8fbaa013cf76136fc430f566f 100644 (file)
@@ -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