skip to content »

supraposuda.ru

Updating hosts file multiple servers

This Handler is the Task called when "Start Nginx" is notified.

updating hosts file multiple servers-56updating hosts file multiple servers-81

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.A lot of this is because it's "just SSH"; It uses SSH to connect to servers and run the configured Tasks.One nice thing about Ansible is that it's very easy to convert bash scripts (still a popular way to accomplish configuration management) into Ansible Tasks.Ansible modules ensure indempotence - we can run the same Tasks over and over without affecting the final result.For installing software on Debian/Ubuntu servers, the "apt" module will run the same command, but ensure idempotence.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.

For testing this article, I created a virtual machine, installed Ansible, and then ran Ansible Tasks directly on that server.

To do this, my This makes testing pretty easy - I don't need to setup multiple servers or virtual machines.

A consequence of this is that I need to tell Ansible to run Tasks as user "vagrant" and use password-based (rather than key-based) authentication.

Once we have an inventory configured, we can start running Tasks against the defined servers.

It will attempt to connect as the current user it is being run as.