And welcome then to our first demonstration.
You know,
I always encourage you to follow along. We're going to be working on our
Ubuntu system, and technically, that's going to be the only system we
need up and running for the duration of this module. I will be using the
others, but only to demonstrate that we're able to ping records that
we've added to our hosts file.
So we'll be looking at installing Puppet, checking the version,
looking at some of the help available from the CLI, and we
can extend it by looking at the Puppet help, the Puppet
describe, and the Puppet resource.
So come on,
let's find that command line and start digging into this valuable
information. And here we are then at our glorious command line, emphasizing
the we. Now we're working on Ubuntu so we know we're going to begin with a
sudo apt update to make sure our package cache is up to date. And with that
then in place, we're able then to go through and search for our packages.
We don't need additional privileges for this, so I can just run apt search
in Puppet, but you can see that I'm getting a lot of information coming
back.
If we want to drill down a little bit,
we can go through and specify where the name begins with puppet.
We can get less coming back here, but we're still getting a lot coming back,
but this is good just to see some of the available Puppet packages. But if we
want to drill down to just the package we're interested in, then if we put
the $ at the end, then you can see we've got the one package. Now this is
what we want, and we're going to be installing this, but it does then just
remind us all how important regular expressions can be in our everyday
command line life.
So let's go ahead then and do our apt install with elevated privileges.
We can go through and use ‑y so it just installs, and
then put in then our puppet package.
This will be good enough for us; it's not the latest and greatest.
We might prefer if we're going to be using this in production to go through
and get a later version from Puppet Labs, but it's going to be good enough for
us to work with, because we want to get us up and running and involved with
the understanding of Puppet, CompTIA that you need to have an understanding of
these configuration management tools. So with it up and running now, we've got
just our Puppet client installed, but we can use that. If we look at puppet
‑‑version,
we've already got an idea of the version from the package name,
but we can see then on a machine that we visited, if it had
Puppet, we can easily check its version.
Now Puppet is made up of a whole load of sub commands.
We can investigate those sub commands by using Puppet and help.
We can even use help on a sub command, so puppet
help, and then let's say generate.
But here, it gives us an idea then of some of the sub commands to look at.
We also should get tab completion within our command as well.
So if I go puppet, and then we can go through and take a look at,
let's say, a describe for help, I can tab complete on describe, and
then the resource that I want help on.
Again,
we're getting some warnings, it's just to do with the version of Puppet that
we're using, but looking at the help for the user resource, this describes
all of the properties that are set for a user.
But we can also get very good help by using the puppet resource command.
If we look at, let's say, a package, a software
package resource, and if we name it,
it will show me the current state on this system.
So package tree is installed and the ensure shows me the version that
I've got. Now we will see later, the very cool thing about the puppet
resource command is I'm able to use the output as a template to manage
other packages, or users, or whatever.
I probably wouldn't use the absolute version, but I
could have ensure and then installed.
If I go through and take a look at this for another resource
type, and let's say $USER, we're able then to go through and see
the properties for my current user, the Vagrant account.
And again, I could easily use this as some form of template. But there you go, we're up and running and understand a little bit about Puppet.