Vars defined within a yml file not changed

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

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.

when: service_mesh | bool

the == is redundant at this point

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

Many thanks for your help. Problem resolved !