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 /etc/ansible/hosts
:
- 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
Playbook executes successfully, but the new host name is not added to the Ansible hosts file. Can anybody help me on this?