title: Ansible - How to keep appending new keys to a dictionary when using set_fact module with with_items?
body: <p>I want to add keys to a dictionary when using set_fact with with_items. This is a small POC which will help me complete some other work. I have tried to generalize the POC so as to remove all the irrelevant details from it.</p>
  
  <p>When I execute following code it is shows a dictionary with only one key that corresponds to the last item of the with_items. It seems that it is re-creating a new dictionary or may be overriding an existing dictionary for every item in the with_items. I want a single dictionary with all the keys.</p>
  
  <p>Code:</p>
  
  <pre><code>---
  - hosts: localhost
    connection: local
    vars:
        some_value: 12345
        dict: {}
    tasks:
       - set_fact: {
            dict: "{
               {{ item }}: {{ some_value }}
               }"
              }
         with_items:
            - 1
            - 2
            - 3
       - debug: msg="{{ dict }}"
  </code></pre>