In this video, we will learn roles on Ansible Galaxy.
You can find a ton of resources on specifically roles through Ansible Galaxy, if that's what you're
looking for.
You can download the predefined or pre-written roles from the Ansible Galaxy.
All you have to do is go to dub dub, dub Galaxy Unsplash.com and search for what you're looking for
and you'll get the answer or result right away.
So let's go to our Firefox, which I have already opened.
And I am already on an en galaxy --.
Now, if you wanted to search for something else, you could go to search.
And then let's say if you want to look up the roles on users so you could type users.
And here you could do filters and be more specific and the type and click on the dropdown and click
on Simply Roll.
And you'll see right here the first result that came in is user creation roll when you click on it.
And you will see in order to install the roles that are already written for you by the Ansible Galaxy,
all you have to do is run this command.
Ansible.
Dash Galaxy.
SpaceX installs SpaceX single platform dash and geo engineering or engine users.
Now this was written three years ago and has all the information, so if you wanted to learn more about
it, you could click on Read Me and find all the information that you want.
Now, if you of course, if you want to create this role in your environment, simply run this command.
So let's go to our control node.
And we are in root directory.
Who am I?
We are in.
We are logged in as root.
Okay, let's go ahead and clear the screen and simply run the command.
Ansible.
All right.
And then just give it a few seconds and you'll see it's downloading roll, which is for users downloading
role from it's giving you the exact path.
And right here, the last line is the version and it's telling you that roll was successfully installed
and where is that roll installed?
And now it does not install inside of your slash at see ansible roll directory it installed on the user's
home directory.
So we are logged in as root.
So you ran this command as root.
So it will download under root home directory right here and it created a directory called Ansible which
is a hidden directory.
So if you do slash root and when you do ls minus l that you won't see this directory because it's hidden
and it starts with dot.
So you have to do dot.
Sorry you have to do CDOT Ansible then the KD roles and do ls minus l and you will see the role directory
is right here.
So let's go to that role directory do ls minus l and you will see it has different roles with the task
meta and here is the read me file as well.
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
is the same YAML file which starts with Main.
Remember this is the same a main file.
All of those YAML files inside of the task of a role will have the same name.
So if you do cat on main yaml file, you'll get all the information that is written inside of this YAML
file.
All right.
So now if you want to take a create a role on this, a user creation, then all you have to do is simply
copy this entire task directory from here to your ETSI and symbol roles directory and start using it
same way.
If you wanted to find some other information on a different role, simply use the search and search
what you're looking for and you'll find nine out of ten.
You'll find the results that you're looking for.