And yes, our first demonstration.
And remember,
it's these demonstrations where you truly get to start learning the product.
Now we're going to be working on our Ubuntu system,
and ideally, we're going to have all three of our systems up and running,
the Ubuntu system, the AlmaLinux system,
and our openSUSE system.
We only need to worry about installing Ansible and sshpass on the Ubuntu system.
We can go through and check the Ansible version and also look
at the other information that is supplied.
We can run ad hoc commands just to illustrate that we are up and
running straightaway with our localhost node.
So come on, let's find that command line.
And look at this,
the marvelous command line where our learning is really going to begin.
Now working on an Ubuntu system,
we're going to make sure that the package cache is up to date.
We're going to need to do this especially when using cloud‑based systems,
even such as Vagrant,
because very often they don't ship with a package cache. So I've just
fired all of my machines up clean, so these are newly installed machines
from my Vagrantfile. I can clear out the screen. And now we've got our
package cache that is up to date,
we're able to install then Ansible from the standard repositories.
So the package we want is ansible, but we're also going to add in the
package sshpass, allowing me then to prompt for SSH passwords. We won't
be setting up key‑based authentication,
although that would be more ideal when managing nodes, so we don't have to
enter passwords. But let's give this the big Enter key and allow the
installation to run through. So we can see then the packages that we are
downloading. It is also worth reminding yourselves at this time that
Ansible is totally Python based, so, of course, we're seeing many
additional Python modules being installed as we look at the package list.
And once this has installed, then we will be up and running with our
Ansible command.
It's worth watching it in real time so you can see then what is actually being
done. But it really doesn't take long, and we're going to be able to get our
systems up and running very quickly. And as we mentioned, out of the box we are
going to be managing the localhost. We need to set up configuration files and
inventory to manage our other hosts, but we will be up and running now with our
Ansible command. So I'm going to clear out my screen, and we're going to go
through and check our version. Now in some ways I'm less interested in the
version.
We can see it's 2.9.6, but you can see I can see where my
configuration file is that we're using, and we can see where the
modules are located, so we get some good information just from
this version command. But as I said,
we are also able to manage the localhost. As a simple test,
we can run the ansible command.
This is running an ad hoc command just straight from the
command line without any playbook.
We can specify our host to work with.
The default host we have is localhost ‑m to specify the module,
and the Ansible module we want to use is ping.
Now this is then testing for a response from Python from our client,
the localhost client, it's not an ICMP ping, but it gives you an idea
that we are up and running. And we'll see other modules as we go
through, but this is a good test to show that we are now working with Ansible at least on our localhost.