Let’s ping some VMs with Ansible, bruh!
Previous
Using Virtualbox VMs
In this portion I’ll be using VMs I have setup on my local machine inside virtualbox to see if we can connect with Ansible.
If you already have virtualbox installed and need to make sure your VMs are able to talk to each other and/or your local machine, then check this out:
The only other thing that you will need for now is the ability to SSH into your VMs — See here:
We know there are a couple ways to SSH into your servers you can SSH in using just a password or you can ssh in using key-based authentication
.
Ansible recommends key-based authentication
and I do too, however I don’t want this tutorial to be a non-starter to where now you have to do all of that before you can start ansible so I’ll cover how to use a password for your servers and then in another Automate with Ansible section, I’ll show you how to create a task to set-up key-based authentication.
Create a directory called: ansible
mkdir ansible && cd ansible
Inside there make another directory called: inventory
mkdir inventory && cd inventory
Add a file called: hosts (don’t worry about an extension — it’s basically an .ini file)
touch hosts