So I’m installing Ansible again to brush up on some things and test out some others, and I’m just setting it up on VirtualBox with a control VM and a few small nodes added to the hosts/inventory right now. I’ve used it before, primarily in one environment for the simple task of SSH key management, which was nice, and a LAMP stack install. This was before I was running cloud services in any of my environments.

All of the VMs involved, including the control machine which I’ve set up as an Ubuntu Desktop, are running 18.04 LTS.

I’ve decided on using Bridged adapters (so they’re just simply part of the local home network) to be sure that I can connect between hosts easily.

Note: Be sure you select the “virtio-net” Adapter type under “Advanced” in the VM settings if you can’t get your guests to pull an IP.

The basic things that I’ve run into so far come down to the following on Ubuntu 18.04:

Most of you may not run into this, but when setting up the install for the host nodes, Python 2 was not installed (this was Ubuntu 18.04 LTS from minimal), however 3 was, but since “python” is not an available command on these boxes from a fresh install, you’ll get a failure. So, at the time to just ran a simple install of python 2 in order to make this work:

sudo apt-get install python-minimal -y

Another issue was SSH user not being recognized, so what do you do? Well, make sure you use ssh-copy-id to copy your key to the node you want to manage, using the following:

ssh-copy-id user@host-or-ip

Once you perform these actions, you should be able to check for connectivity to the remote host/inventory item by running Ansible’s ping module:

ansible all -m ping -u [user on remote host]

The response you should get will be:

X.X.X.X | SUCCESS => {
“changed”: false,
“ping”: “pong”
}

(where X.X.X.X is the host you’re trying to ping)

That’s pretty much it that I can think of for now, and I’ll probably throw up another post soon. Good luck and happy infrastructure automation!