title: how to use json file consisting of host info as input to ansible inventory
body: <p>I am trying to use the following json file as input to ansible host inventory but I get error when I run the playbook.
  <strong>JSON File:</strong></p>
  
  <pre><code>{
     "instances":{
         "host": 10.66.70.33
     }
  }
  </code></pre>
  
  <h2>Playbook:</h2>
  
  <blockquote>
    <p>hosts: "{{ instances.host }}"<br>
    remote_user: root   #vars:</p>
  </blockquote>
  
  <p>When I run the play book I get the following errors. I am not sure where I am doing wrong. I am new to Ansible. Please advice I guess i am doing some silly mistake.</p>
  
  <blockquote>
    <p>[WARNING]: Could not match supplied host pattern, ignoring: all 
    [WARNING]: provided hosts list is empty, only localhost is available
    ERROR! The field 'hosts' has an invalid value, which includes an
    undefined variable. The error was: 'instances' is undefined</p>
  </blockquote>
  
  <p><strong>I am running the playbook as follows:</strong></p>
  
  <pre><code>ansible-playbook -i &lt;path&gt;/test.json &lt;path&gt;test_playbook.yml
  </code></pre>