title: Fail to get values from dictionary in ansible playbook
body: <p>I'm trying to get some values from a dictionary in ansible playbook.
  First, I build the dictionary and it runs correctly.
  Then, I would compute the output_dict evaluating the values of this dictionary but I have the issue above.</p>
  <pre><code>- set_fact:
      state_service: &quot;{{ state_service | default({}) | combine({ item.key : item.value }) }}&quot;
    with_items:
      - { 'key': 'op_state', 'value': &quot;{{Check_Operative_State.results[0].stdout}}&quot;}
      - { 'key': 'ad_state', 'value': &quot;{{Check_Administrative_State.results[0].stdout}}&quot;}
  
  - name: Display the state of service
    debug: msg=&quot;{{state_service}}&quot;
  
  - set_fact:
      output_dict: '{{output_dict | default([]) + [&quot;CHECK ERRORS IN SERVICE ************PASSED&quot; if ((item.op_state == &quot;enabled&quot; and item.ad_state == &quot;unlocked&quot;) or (item.op_state == &quot;disabled&quot; and item.ad_state == &quot;locked&quot;)) else &quot;CHECK ERRORS IN SERVICE **********FAILED&quot;] }}'
    with_items: &quot;{{state_service}}&quot;
  </code></pre>
  <p>The error:</p>
  <pre><code>**************************************************
  2022-02-04 19:04:45,341 p=4478 u=abcd n=ansible | ok: [localhost] =&gt; {
      &quot;msg&quot;: {
          &quot;ad_state&quot;: &quot;unlocked&quot;,
          &quot;op_state&quot;: &quot;enabled&quot;
      }
  }
  2022-02-04 19:04:45,366 p=4478 u=abcd n=ansible | TASK [check : set_fact] ************************************************************************************************************************************************************************
  2022-02-04 19:04:45,366 p=4478 u=abcd n=ansible | fatal: [localhost]: FAILED! =&gt; {&quot;msg&quot;: &quot;The task includes an option with an undefined variable. The error was: 'ansible.utils.unsafe_proxy.AnsibleUnsafeText object' has no attribute 'op_state'\n\nThe error appears to be in '/home/abcd/health/service/script/roles/health/tasks/main.yaml': line 483, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- set_fact:\n  ^ here\n&quot;}
  2022-02-04 19:04:45,368 p=4478 u=abcd n=ansible | PLAY RECAP *****************************************************************************************************************************************
  </code></pre>