- All right.
So first part is to use Ad-hoc commands
for Ansible facts on the windows server.
Let's do an Ansible doc pipe grep.
Everything starting win.
Oh, my mistake.
Minus L.
Now we can see the different windows options.
So is there anything with facts?
And we have a win chocolatey
and a win disk facts and a win product facts.
That's an interesting one.
We don't have anything at first sight.
So, okay.
So let's do Ansible.
And of course we need to tweak the inventory
with the windows machine.
Let's do Ansible
windows minus M
win disk facts.
Or maybe a little bit easier, win product facts.
And that should be reaching out to the windows server
and give us product facts.
Fact gathering can always take a little bit of time.
So sit it out, be patient and oh, no!
What do we get?
Well, we get failed to connect to the hosts via ssh.
Does that make sense?
Yes, that makes sense because you remember,
we had this separate windows product directory.
And in this product directory,
there was an inventory and this inventory
is telling us to use win RM instead of SSH.
So let's run it again and see if that is better.
And should almost be better.
We should be looking at win, not windows.
And now we can see, yay fact gathering is working.
Now, how about users?
Well, I would say Ansible doc win user.
Just a wild guess.
And yay, we have a win user.
And if I want to use a module like this,
I need to look for mandatory options.
And I would say a name is a mandatory option
and maybe also a password.
Plain text, that's okay with me.
Name and password.
So Ansible
win minus m win user minus a.
Name is Anna.
Password is password.
And uh-oh.
Well, at least we can see that windows is answering.
So let's do a secure password.
Like I told you before,
putting passwords this way is not really elegant.
Later in this course you will learn about Ansible vault,
which is telling you how to do it in a really secure way.
But for now, it should work.
And there we go, user has just been created.
And that's how it works.
That's all.
Let's continue with the next lesson
which is about playbooks.