1 00:00:00,590 --> 00:00:04,400 In this video, we will learn roles on Ansible Galaxy. 2 00:00:04,400 --> 00:00:11,030 You can find a ton of resources on specifically roles through Ansible Galaxy, if that's what you're 3 00:00:11,030 --> 00:00:11,690 looking for. 4 00:00:11,720 --> 00:00:18,050 You can download the predefined or pre-written roles from the Ansible Galaxy. 5 00:00:18,050 --> 00:00:26,420 All you have to do is go to dub dub, dub Galaxy Unsplash.com and search for what you're looking for 6 00:00:26,420 --> 00:00:29,680 and you'll get the answer or result right away. 7 00:00:29,690 --> 00:00:34,580 So let's go to our Firefox, which I have already opened. 8 00:00:35,890 --> 00:00:40,460 And I am already on an en galaxy --. 9 00:00:41,230 --> 00:00:45,850 Now, if you wanted to search for something else, you could go to search. 10 00:00:46,150 --> 00:00:54,460 And then let's say if you want to look up the roles on users so you could type users. 11 00:00:55,180 --> 00:01:05,950 And here you could do filters and be more specific and the type and click on the dropdown and click 12 00:01:05,950 --> 00:01:07,330 on Simply Roll. 13 00:01:07,810 --> 00:01:14,050 And you'll see right here the first result that came in is user creation roll when you click on it. 14 00:01:14,880 --> 00:01:22,670 And you will see in order to install the roles that are already written for you by the Ansible Galaxy, 15 00:01:22,680 --> 00:01:24,900 all you have to do is run this command. 16 00:01:24,900 --> 00:01:25,740 Ansible. 17 00:01:25,770 --> 00:01:27,090 Dash Galaxy. 18 00:01:27,090 --> 00:01:34,890 SpaceX installs SpaceX single platform dash and geo engineering or engine users. 19 00:01:35,550 --> 00:01:41,400 Now this was written three years ago and has all the information, so if you wanted to learn more about 20 00:01:41,400 --> 00:01:45,760 it, you could click on Read Me and find all the information that you want. 21 00:01:45,780 --> 00:01:51,600 Now, if you of course, if you want to create this role in your environment, simply run this command. 22 00:01:51,610 --> 00:01:54,900 So let's go to our control node. 23 00:01:57,240 --> 00:02:01,650 And we are in root directory. 24 00:02:02,550 --> 00:02:03,450 Who am I? 25 00:02:03,480 --> 00:02:05,160 We are in. 26 00:02:05,250 --> 00:02:06,300 We are logged in as root. 27 00:02:06,360 --> 00:02:09,300 Okay, let's go ahead and clear the screen and simply run the command. 28 00:02:09,300 --> 00:02:10,140 Ansible. 29 00:02:15,290 --> 00:02:15,980 All right. 30 00:02:15,980 --> 00:02:24,290 And then just give it a few seconds and you'll see it's downloading roll, which is for users downloading 31 00:02:24,300 --> 00:02:27,700 role from it's giving you the exact path. 32 00:02:27,710 --> 00:02:34,550 And right here, the last line is the version and it's telling you that roll was successfully installed 33 00:02:34,670 --> 00:02:37,490 and where is that roll installed? 34 00:02:37,490 --> 00:02:45,590 And now it does not install inside of your slash at see ansible roll directory it installed on the user's 35 00:02:45,590 --> 00:02:46,850 home directory. 36 00:02:46,850 --> 00:02:48,560 So we are logged in as root. 37 00:02:48,560 --> 00:02:50,780 So you ran this command as root. 38 00:02:50,780 --> 00:02:57,650 So it will download under root home directory right here and it created a directory called Ansible which 39 00:02:57,650 --> 00:02:58,820 is a hidden directory. 40 00:02:58,820 --> 00:03:06,080 So if you do slash root and when you do ls minus l that you won't see this directory because it's hidden 41 00:03:06,080 --> 00:03:07,400 and it starts with dot. 42 00:03:07,400 --> 00:03:09,620 So you have to do dot. 43 00:03:11,070 --> 00:03:20,670 Sorry you have to do CDOT Ansible then the KD roles and do ls minus l and you will see the role directory 44 00:03:20,670 --> 00:03:21,270 is right here. 45 00:03:21,270 --> 00:03:29,100 So let's go to that role directory do ls minus l and you will see it has different roles with the task 46 00:03:29,730 --> 00:03:32,250 meta and here is the read me file as well. 47 00:03:32,250 --> 00:03:40,200 So let's go to the task because we want to take that role as a task now minus L and inside of that task 48 00:03:40,200 --> 00:03:43,410 is the same YAML file which starts with Main. 49 00:03:43,410 --> 00:03:45,630 Remember this is the same a main file. 50 00:03:45,630 --> 00:03:51,000 All of those YAML files inside of the task of a role will have the same name. 51 00:03:51,000 --> 00:03:59,850 So if you do cat on main yaml file, you'll get all the information that is written inside of this YAML 52 00:03:59,850 --> 00:04:00,300 file. 53 00:04:00,720 --> 00:04:01,080 All right. 54 00:04:01,080 --> 00:04:09,780 So now if you want to take a create a role on this, a user creation, then all you have to do is simply 55 00:04:09,780 --> 00:04:18,390 copy this entire task directory from here to your ETSI and symbol roles directory and start using it 56 00:04:18,480 --> 00:04:19,230 same way. 57 00:04:19,230 --> 00:04:25,320 If you wanted to find some other information on a different role, simply use the search and search 58 00:04:25,320 --> 00:04:29,250 what you're looking for and you'll find nine out of ten. 59 00:04:29,250 --> 00:04:31,830 You'll find the results that you're looking for.