Vars defined within a yml file not changed

19 views
Skip to first unread message

cmou...@redhat.com

unread,
Mar 22, 2018, 12:12:19 PM3/22/18
to Ansible Project
Hi,

This syntax works to override the var "service_mesh" when we execute this ansible playbook command

 "ansible-playbook -i inventory/cloud_host playbook/post_installation.yml -e service_mesh=true"

but the var is not set to true if thethis var is defined  within a extra_vars.yml file and the following command executed

 "ansible-playbook -i inventory/cloud_host playbook/post_installation.yml -e @extra_vars.yml"

Snapshot of the extra_vars.yml file


---
# Global vars
openshift_node: masters

infra_project: infra
target_platform: local
experimental_features: disable
service_mesh: true

Do I miss something ?

Regards

Charles

Kai Stian Olstad

unread,
Mar 22, 2018, 12:22:49 PM3/22/18
to ansible...@googlegroups.com
service_mesh=true and service_mesh: true is not the same.
The first one is a the string true and the second one is the boolean value true.

So you should always filter the variable thru the bool filter like so

when: service_mesh | bool == true

Then it will work if service_mesh is a string or a bool.


--
Kai Stian Olstad

Brian Coca

unread,
Mar 22, 2018, 12:30:42 PM3/22/18
to Ansible Project
when: service_mesh | bool

the == is redundant at this point



--
----------
Brian Coca

Kai Stian Olstad

unread,
Mar 22, 2018, 12:35:31 PM3/22/18
to ansible...@googlegroups.com
On Thursday, 22 March 2018 17.30.23 CET Brian Coca wrote:
> when: service_mesh | bool
>
> the == is redundant at this point

I know, but I like reading and using explicit rather than implicit code.

--
Kai Stian Olstad

cmou...@redhat.com

unread,
Mar 22, 2018, 12:39:14 PM3/22/18
to Ansible Project
Many thanks for your help. Problem resolved !
Reply all
Reply to author
Forward
0 new messages