undercloud_enable_novajoin variable is not being respected as a bool
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
tripleo |
Fix Released
|
Critical
|
wes hayutin |
Bug Description
To properly debug what is going on, I created the following playbook.
#######
---
- name: foo
hosts: localhost
tasks:
- name: print
debug:
msg: "{{ undercloud_
- name: print type
debug:
msg: "{{ undercloud_
#######
I have the following two yaml variable files.
1. Original vars - novajoin.yaml
#######
undercloud_
{% if release in ['queens', 'rocky', 'stein', 'train'] -%}
true
{%- else -%}
false
{%- endif -%}
#######
2. Updated vars - novajoin_bool.yaml
#######
undercloud_
{% if release in ['queens', 'rocky', 'stein', 'train'] -%}
True
{%- else -%}
False
{%- endif -%}
#######
***************** RESULTS for #1 *****************
[root@localhost tmp]# ansible-playbook -e release=master -e @novajoin.yaml test.yml
[WARNING]: Ansible is being run in a world writable directory (/var/tmp), ignoring it as an ansible.cfg source. For more information see
https:/
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
PLAY [foo] *******
TASK [Gathering Facts] *******
ok: [localhost]
TASK [print] *******
ok: [localhost] => {
"msg": "false"
}
TASK [print type] *******
ok: [localhost] => {
"msg": "str"
}
PLAY RECAP *******
localhost : ok=3 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
***************** RESULTS for #2 *****************
[root@localhost tmp]# ansible-playbook -e release=master -e @novajoin_bool.yaml test.yml
[WARNING]: Ansible is being run in a world writable directory (/var/tmp), ignoring it as an ansible.cfg source. For more information see
https:/
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
PLAY [foo] *******
TASK [Gathering Facts] *******
ok: [localhost]
TASK [print] *******
ok: [localhost] => {
"msg": false
}
TASK [print type] *******
ok: [localhost] => {
"msg": "bool"
}
PLAY RECAP *******
localhost : ok=3 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
[root@localhost tmp]#
It seems that yaml + jinja2 does not respect the lowercase "false/true" as boolean where ansible does when you directly set the variable foo: true.
When using jinja in a variables file, one MUST use the CamelCase for true/false as True/False.
Changed in tripleo: | |
assignee: | nobody → wes hayutin (weshayutin) |
status: | Triaged → In Progress |
Reviewed: https:/ /review. opendev. org/754408 /git.openstack. org/cgit/ openstack/ tripleo- quickstart/ commit/ ?id=cf9d8268c2a e33dda084fe7640 86973cdf20f8d1
Committed: https:/
Submitter: Zuul
Branch: master
commit cf9d8268c2ae33d da084fe76408697 3cdf20f8d1
Author: Ade Lee <email address hidden>
Date: Fri Sep 25 10:29:59 2020 -0400
making sure undercloud_ enable_ novajoin set correctly
Closes-Bug: #1897414 63fbbc71f13457d d65fe7a0015
Change-Id: I69a2614f0b6864