roles, when, hostvars and conditionals || error while evaluating conditional: X==X

Hi

I have faced a syntax/jinja/bug? issue while evalutating conditionals in ‘when’
{role: restart, action: restart, app: web, when: "{{ hostvars[groups['web'][0]]['result']['state'] }}" == 'SUSPENDED']} #Not working {role: restart, action: restart, app: web, when: "{{'SUSPEND' in hostvars[groups['web'][0]]['result']['state'] }}"} #Working

I’m not sure is that a bug, I did find a way to ‘play it’ but it was not clear.
I’ll make this post for future ansible users :slight_smile:

playbook:

`