Updating hosts file multiple 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.

Here we simply tell Ansible that we want Nginx to be started.

$ ansible-playbook -s PLAY [local] ****************************************************************** GATHERING FACTS *************************************************************** ok: [] TASK: [Install Nginx] ********************************************************* ok: [] NOTIFIED: [nginx | Start Nginx] *********************************************** ok: [] PLAY RECAP ******************************************************************** : ok=2 changed=0 unreachable=0 failed=0 We can use Playbooks to run multiple Tasks, add in variables, define other settings and even include other playbooks.

Here I'll show how easy it is to get started with Anible.

We'll start basic and then add in more features as we improve upon our configurations. Tasks can be run off of any machine Ansible is installed on.

For installing software on Debian/Ubuntu servers, the "apt" module will run the same command, but ensure idempotence.This means there's usually a "central" server running Ansible commands, although there's nothing particularly special about what server Ansible is installed on.Ansible is "agentless" - there's no central agent(s) running.We can run all of our needed Tasks (via modules) in this ad-hoc way, but let's make this more managable.We'll move this Task into a Playbook, which can run and coordinate multiple Tasks.

Leave a Reply