Dynamic hosts file with Ansible

ansible with vagrant

Hosts file

hosts file consist a map of some hostname to IP Addresses before DNS can be referenced, plain text, leftmost column is the IP address. The next column is the host’s name.  Some people only using DNS to manage their hosts, others using both (DNS and hosts file), you can choose your own flavor. DNS is run but it could fail at any time, best practice, it’s always good to rely on /etc/hosts.

If i can recall, before deploying with ansible or any other orchestration engine, we do lot of stuff using manual bash scripting, ssh passwordless and ‘for loop’ to repeat the script for updating the host files. Now dynamic updating the host file for hundred or thousand machine much easier with ansible.

(more…)