Syntax Issues for When Conditional

Hi,

What is the proper syntax for trying to do something like this? It works fine but it gives me a warning that says not to use templating delimiters.

when: “{{ customer }}.aws_cloud_formation_state == ‘present’”

I have tried just doing

when: customer.aws_cloud_formation_state == ‘present’

but that just goes into the customer dictionary looking for aws_cloud_formation. I would like to take a variable ‘customer’ and use it as the conditional. It works fine, but what is the correct syntax for getting it to work without giving a warning.

Thank you!
Mark

You need to use vars

when: vars[customer].aws_cloud_formation_state == 'present'

That did the trick!

Thank you!