title: Ansible Dictionary/Hash Key as Special Variable
body: <p>I'm trying to set an Ansible fact as a dict/hash but would like to use a special variable as the key.  In my case I want to use the special variable <code>inventory_hostname</code>. However, when I attempt this the value is returned as a string instead of the actual name of the hostname machine. How can I set the key to the special variable <code>inventory_hosthame</code> instead?</p>
  
  <p>I've tried the below with no avail.</p>
  
  <p>set_fact:        </p>
  
  <pre><code>  set_fact:
      result_dict:
        "{{inventory_hostname}}": 'Linux'
  
    set_fact:
      result_dict:
        inventory_hostname: 'Linux'
  </code></pre>
  
  <p>Instead of the actual inventory_hostname I am being returned just the string value.</p>
  
  <p><strong>Current Output:</strong></p>
  
  <pre><code>    ok: [host-a] =&gt; {
      "result_dict": {
          "{{inventory_hostname}}": "Linux"
      }
  }
  </code></pre>