Updating hosts file multiple servers
Ansible uses these facts to check state and see if it needs to change anything in order to get the desired outcome.
This makes it safe to run Ansible Tasks against a server over and over again.
Because Ansible uses SSH, the server it's on needs to be able to SSH into the inventory servers.
With this context, Ansible is able to handle most edge cases - the kind we usually take care of with longer and increasingly complex scripts. Without a lot of extra coding, bash scripts are usually not safety run again and again.
Ansible uses "Facts", which is system and environment information it gathers ("context") before running Tasks.
If we need to define the user and perhaps some other settings in order to connect to our server, we can.
When testing locally on Vagrant, I use the following: way to use Ansible, as they can use available context ("Facts") in order to determine what actions, if any need to be done to accomplish a Task.If we didn't have modules, we'd be left running arbitrary shell commands like this: . While it's handy to be able to run these commands on all of our servers at once, we still only accomplish what any bash script might do.