How to assign set_fact variable some value based on condition ?

MYUSER should be assigned value “wsadm” or “user1” based on the output of {{ command_result.stdout.split(‘\t’)[1] }}

I tried the below however, I’m getting error when I run.

My playbook looks like below:

`

Remove the curly braces in your condition

I tried both suggestion but it still errors out:

MYUSER: "wsadm" when: command_result.stdout.split('\t')[3] == 'WAS' MYUSER: "user1" when: command_result.stdout.split('\t')[3] == 'APP'

MYUSER: "wsadm" when: "command_result.stdout.split('\t')[3]" == 'WAS' MYUSER: "user1" when: "command_result.stdout.split('\t')[3]" == 'APP'

Still getting error: