Let me take a moment before we get into our Ansible work
specifically to describe our demo environment.
As you can see in this About Windows dialog,
I'm on a Windows Server 2022 machine.
It's actually set up as a domain controller.
Its host name is control1.timw.info.
Here I am in Visual Studio Code,
and I have the class exercise files loaded up in my explorer view here.
Now I make all of those available to you in the course downloads,
as I just said.
Forgive me for them not being organized.
It's just to dump of file.
Sorry about that.
But let's get into this here.
First of all, if you're going to set up your Ansible controller on Windows,
WSL or Windows Subsystem for Linux is a great idea.
It's even easier if you're using Windows Server 2022.
You just pop open an elevated command prompt and do wsl ‑‑install.
You might have more work to do if you're running a
down level version of Windows server.
I'll just kick you out to the docs to look that up.
Once you finish that, just a plain vanilla WSL install will give you Ubuntu,
which works just fine as an Ansible controller.
So the next few examples‑‑‑ By the way, just to call it out,
this file is called install‑ansible‑windows,
and it's just a run of sample console commands.
I mean, I guess I could type along in the demo,
but I didn't want to leave anything out.
And I also have all these files for your reference.
So hopefully you find it helpful.
Anyway, lines 10 on down here are coming from the WSL environment.
So here I am.
This is my connection to that machine.
So this is an Ubuntu machine called control1.
Well,
that's kind of awkward because my domain controller is also called control1.
Oh, I probably should have thought of that earlier.
Oh well.
We're going to keep on trucking.
The WSL controller is going to be managing this machine,
this control1 domain controller, as well as one other Windows machine.
Anyway, sudo apt update, just the standard fare,
getting your repository and package lists current.
And then here, we're going to add in the Ansible package archive.
So we prepare the system for that.
Then we add in Ansible's package archive so we then can easily install
the core distribution of Ansible directly from Ansible,
as you can see on line 20.
We're using Kerberos authentication,
so we need to install Kerberos on our controller.
That's what you see here on line 23.
Another thing that we want to use is Ansible Vault.
Now, this is a fundamentals course,
so I try to cover just the tightest array of skills as possible.
But we need to understand and use Ansible Vault because we
never want to have our passwords that say the Ansible service
account is using in plain text, much less committed to source control.
So, I'm just showing you that on the Ansible machine here,
you can use the Ansible Vault that's a command line interface or
CLI command to touch or create a YAML file.
So I've already done this.
I created a new file called vault.yml.
And you can edit the file.
It'll kick open the file in its own editor.
And in my vault.yml, I just defined a variable called ansible_password,
which is a common reserved variable name that Ansible understands.
And that's where I finally put the plain text of my
Ansible service account password.
And the idea is whenever we run a playbook or a role,
we can decrypt that password and resolve a value for
Ansible password by unlocking the vault.
And so I'm just taking you into Vault step by step.
So that's just some background info.
So we've got a vault file available to me in my home directory.
All right, cool.
So, once you've done all that, you've got a controller.
So we might as well switch over again to our WSL environment.
And a quick check is to do an ansible ‑‑version.
And the Ansible version feedback is actually really handy.
Specifically notice it echoes where its default config file is,
where the executables and engine, what those versions are.
So this can be useful for a first line when you're troubleshooting
a system just to see what you're looking at.
What specific version in addition of Ansible are you running?
You see.
Some other things we need to take care of and we'll actually formally
treat it in the next lesson are making sure we've got a working
ansible.cfg file and also our hosts file or our inventory.
We'll want to make sure where that is.
In fact, I could just do, say, a cat of home/tim/ansible.cfg,
and we'll take a quick look at what's in the file.