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
pull/1931/head
Günther Grill 2017-11-03 08:11:14 +01:00 committed by Matthew Mosesohn
parent ec1170bd37
commit 0195725563
1 changed files with 11 additions and 10 deletions

View File

@ -28,20 +28,21 @@
when: cloud_provider is defined and cloud_provider == 'azure' when: cloud_provider is defined and cloud_provider == 'azure'
ignore_errors: "{{ ignore_assert_errors }}" 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 }\")" - name: "Stop if known booleans are set as strings (Use JSON format on CLI: -e \"{'key': true }\")"
assert: assert:
that: vars[item]|type_debug == 'bool' that: item.value|type_debug == 'bool'
msg: "{{vars[item]}} isn't a bool" msg: "{{item.value}} isn't a bool"
run_once: yes run_once: yes
with_items: with_items:
- kubeadm_enabled - { name: kubeadm_enabled, value: "{{ kubeadm_enabled }}" }
- download_run_once - { name: download_run_once, value: "{{ download_run_once }}" }
- deploy_netchecker - { name: deploy_netchecker, value: "{{ deploy_netchecker }}" }
- download_always_pull - { name: download_always_pull, value: "{{ download_always_pull }}" }
- efk_enabled - { name: efk_enabled, value: "{{ efk_enabled }}" }
- helm_enabled - { name: helm_enabled, value: "{{ helm_enabled }}" }
- openstack_lbaas_enabled - { name: openstack_lbaas_enabled, value: "{{ openstack_lbaas_enabled }}" }
- rbac_enabled - { name: rbac_enabled, value: "{{ rbac_enabled }}" }
ignore_errors: "{{ ignore_assert_errors }}" ignore_errors: "{{ ignore_assert_errors }}"
- name: Stop if even number of etcd hosts - name: Stop if even number of etcd hosts