1 00:00:06,770 --> 00:00:07,603 - All right. 2 00:00:07,603 --> 00:00:10,840 So first part is to use Ad-hoc commands 3 00:00:10,840 --> 00:00:13,890 for Ansible facts on the windows server. 4 00:00:13,890 --> 00:00:17,220 Let's do an Ansible doc pipe grep. 5 00:00:19,130 --> 00:00:21,123 Everything starting win. 6 00:00:22,510 --> 00:00:24,303 Oh, my mistake. 7 00:00:25,330 --> 00:00:26,810 Minus L. 8 00:00:26,810 --> 00:00:29,840 Now we can see the different windows options. 9 00:00:29,840 --> 00:00:33,483 So is there anything with facts? 10 00:00:35,220 --> 00:00:37,610 And we have a win chocolatey 11 00:00:37,610 --> 00:00:41,110 and a win disk facts and a win product facts. 12 00:00:41,110 --> 00:00:42,380 That's an interesting one. 13 00:00:42,380 --> 00:00:46,200 We don't have anything at first sight. 14 00:00:46,200 --> 00:00:47,993 So, okay. 15 00:00:48,850 --> 00:00:50,923 So let's do Ansible. 16 00:00:55,144 --> 00:00:57,697 And of course we need to tweak the inventory 17 00:00:59,890 --> 00:01:01,550 with the windows machine. 18 00:01:01,550 --> 00:01:02,490 Let's do Ansible 19 00:01:04,800 --> 00:01:07,800 windows minus M 20 00:01:09,140 --> 00:01:11,713 win disk facts. 21 00:01:12,560 --> 00:01:17,560 Or maybe a little bit easier, win product facts. 22 00:01:19,550 --> 00:01:21,670 And that should be reaching out to the windows server 23 00:01:21,670 --> 00:01:23,713 and give us product facts. 24 00:01:25,520 --> 00:01:28,070 Fact gathering can always take a little bit of time. 25 00:01:28,070 --> 00:01:31,180 So sit it out, be patient and oh, no! 26 00:01:31,180 --> 00:01:32,013 What do we get? 27 00:01:32,013 --> 00:01:35,280 Well, we get failed to connect to the hosts via ssh. 28 00:01:35,280 --> 00:01:36,113 Does that make sense? 29 00:01:36,113 --> 00:01:38,393 Yes, that makes sense because you remember, 30 00:01:39,270 --> 00:01:43,550 we had this separate windows product directory. 31 00:01:43,550 --> 00:01:45,260 And in this product directory, 32 00:01:45,260 --> 00:01:47,440 there was an inventory and this inventory 33 00:01:47,440 --> 00:01:50,940 is telling us to use win RM instead of SSH. 34 00:01:50,940 --> 00:01:55,940 So let's run it again and see if that is better. 35 00:01:56,390 --> 00:01:58,930 And should almost be better. 36 00:01:58,930 --> 00:02:02,160 We should be looking at win, not windows. 37 00:02:02,160 --> 00:02:05,793 And now we can see, yay fact gathering is working. 38 00:02:06,680 --> 00:02:09,430 Now, how about users? 39 00:02:09,430 --> 00:02:14,430 Well, I would say Ansible doc win user. 40 00:02:14,880 --> 00:02:16,720 Just a wild guess. 41 00:02:16,720 --> 00:02:18,880 And yay, we have a win user. 42 00:02:18,880 --> 00:02:21,630 And if I want to use a module like this, 43 00:02:21,630 --> 00:02:24,330 I need to look for mandatory options. 44 00:02:24,330 --> 00:02:28,290 And I would say a name is a mandatory option 45 00:02:28,290 --> 00:02:31,073 and maybe also a password. 46 00:02:32,870 --> 00:02:35,170 Plain text, that's okay with me. 47 00:02:35,170 --> 00:02:36,123 Name and password. 48 00:02:37,030 --> 00:02:39,730 So Ansible 49 00:02:39,730 --> 00:02:44,410 win minus m win user minus a. 50 00:02:44,410 --> 00:02:45,803 Name is Anna. 51 00:02:46,820 --> 00:02:50,673 Password is password. 52 00:02:51,560 --> 00:02:52,940 And uh-oh. 53 00:02:52,940 --> 00:02:55,883 Well, at least we can see that windows is answering. 54 00:02:56,760 --> 00:03:00,003 So let's do a secure password. 55 00:03:06,010 --> 00:03:08,250 Like I told you before, 56 00:03:08,250 --> 00:03:11,580 putting passwords this way is not really elegant. 57 00:03:11,580 --> 00:03:14,430 Later in this course you will learn about Ansible vault, 58 00:03:14,430 --> 00:03:17,040 which is telling you how to do it in a really secure way. 59 00:03:17,040 --> 00:03:19,733 But for now, it should work. 60 00:03:21,460 --> 00:03:25,060 And there we go, user has just been created. 61 00:03:25,060 --> 00:03:26,560 And that's how it works. 62 00:03:26,560 --> 00:03:27,393 That's all. 63 00:03:27,393 --> 00:03:28,680 Let's continue with the next lesson 64 00:03:28,680 --> 00:03:30,223 which is about playbooks.