Workaround ansible bug where access var via dict doesn't get real value (#1912)

* Change deprecated vagrant ansible flag 'sudo' to 'become'

* Workaround ansible bug where access var via dict doesn't get real value

When accessing a variable via it's name "{{ foo }}" its value is
retrieved. But when the variable value is retrieved via the vars-dict
"{{ vars['foo'] }}" this doesn't resolve the expression of the variable
any more due to a bug. So e.g. a expression foo="{{ 1 == 1 }}" isn't
longer resolved but just returned as string "1 == 1".

* Make file yamllint complient
This commit is contained in:
Günther Grill 2017-11-03 08:11:14 +01:00 committed by Matthew Mosesohn
parent ec1170bd37
commit 0195725563

View file

@ -28,20 +28,21 @@
when: cloud_provider is defined and cloud_provider == 'azure'
ignore_errors: "{{ ignore_assert_errors }}"
# simplify this items-list when https://github.com/ansible/ansible/issues/15753 is resolved
- name: "Stop if known booleans are set as strings (Use JSON format on CLI: -e \"{'key': true }\")"
assert:
that: vars[item]|type_debug == 'bool'
msg: "{{vars[item]}} isn't a bool"
that: item.value|type_debug == 'bool'
msg: "{{item.value}} isn't a bool"
run_once: yes
with_items:
- kubeadm_enabled
- download_run_once
- deploy_netchecker
- download_always_pull
- efk_enabled
- helm_enabled
- openstack_lbaas_enabled
- rbac_enabled
- { name: kubeadm_enabled, value: "{{ kubeadm_enabled }}" }
- { name: download_run_once, value: "{{ download_run_once }}" }
- { name: deploy_netchecker, value: "{{ deploy_netchecker }}" }
- { name: download_always_pull, value: "{{ download_always_pull }}" }
- { name: efk_enabled, value: "{{ efk_enabled }}" }
- { name: helm_enabled, value: "{{ helm_enabled }}" }
- { name: openstack_lbaas_enabled, value: "{{ openstack_lbaas_enabled }}" }
- { name: rbac_enabled, value: "{{ rbac_enabled }}" }
ignore_errors: "{{ ignore_assert_errors }}"
- name: Stop if even number of etcd hosts