title: Adding hosts to Ansible host file
body: <p>I have been trying to add a host name to my hosts file using an Ansible playbook. My Ansible play look as below and my host file resides at <code>/etc/ansible/hosts</code>:</p>
  
  <pre><code>- name: adding host playbook
    hosts: localhost
    connection: local
    tasks:
    - name: add host to ansible host file
      add_host:
        name: myvm.cloud.azure.com
        groups: mymasters
  </code></pre>
  
  <p>Playbook executes successfully, but the new host name is not added to the Ansible hosts file. Can anybody help me on this?</p>