Issuew when doing a When conditional with win_copy

Hello all,
I am trying to do a conditional based on the output of a win_shell. When I run this it’s as if it doesn’t see the conditional and copies to to all inventory not just what is coming back as True. Any ideas?

Your when statement, needs to be indented to the same level as win_copy, not the same level as dest. Also it needs to be the lowercased when

Matt, I now see it is attempting it but I get and erroron win_copy:{
“msg”: “The conditional check ‘ansible_facts[‘results.stdout’] == "True"’ failed. The error was: error while evaluating conditional (ansible_facts[‘results.stdout’] == "True"): ‘dict object’ has no attribute ‘results.stdout’\n\nThe error appears to be in ‘/var/lib/awx/projects/_8__test_project/Win_Feature_SQL.yml’: line 11, column 6, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n output: "{{ results.stdout }}"\n - win_copy:\n ^ here\n”,
“_ansible_no_log”: false
}

I do see my results from win_shell though:

{
“changed”: false,
“ansible_facts”: {
“output”: “True\n”
},
“_ansible_no_log”: false
}

results.stdout is not a literal variable name. Instead what you are likely looking for is:

when: results.stdout|trim == ‘True’

or since you use set_fact in between, it could also be:

when: output|trim == ‘True’

That worked, Thanks for the help Matt. Much appreciated