title: ansible- host alias with dynamic inventory
body: <p>I have the following static inventory file:</p>
  
  <pre><code>[nodes:children]
  masters
  workers
  
  [masters]
  node1 ansible_host=1.2.3.4 ansible_port=2220 ansible_user=vagrant ansible_private_key_file=keys/id_rsa
  
  [workers]
  node2 ansible_host=1.2.3.4 ansible_port=2221 ansible_user=vagrant ansible_private_key_file=keys/id_rsa
  </code></pre>
  
  <p>Because my hosts use the same IP, but different ssh ports I need to alias them to so that ansible can see them as two hosts.</p>
  
  <p>I'm trying to use a dynamic inventory script to generate this, but I'm struggling to find any information on the format of the json the I need to return, more specifically - how to alias the hosts.</p>
  
  <p>So my question - does anyone know the json equivalent of the above static inventory file or somewhere where I can find information on the json format?    </p>