What is Ansible Galaxy
Ansible Galaxy is a repository for Ansible Roles that are available to drop directly into your Playbooks to streamline your automation projects. It is easy to get up and running with Ansible. Even a new sysadmin could start automating with Ansible in a matter of a few hours. Ansible automates using the SSH protocol.
In this blog, we are going to do how to import a Single Ansible role into an Ansible Galaxy. I hope you all have read the previous article on how to create a role for setting up Kubernetes multi-node cluster using ansible if not you can read it by clicking on the below link.
K8S Multi-Node Cluster On AWS Using Ansible and Launching A WordPress Application With MYSQL…
configuring a Kubernetes Multi-Node Cluster over EC2…
Login to Ansible Galaxy from below you can login
Jump start your automation project with great content from the Ansible community
GitHub even we can upload locally but GitHub login is needed
After Login we can see most popular roles Home menu
Now all setup is set we can create an Ansible-Galaxy
Make sure in your ansible having system installed GIT if not installed here we are using Linux RHEL8.
>> yum install git -y
Then create a ansible-galaxy(role)
ansible-galaxy role init Test_Role
Go to GitHub click on new and create a GitHub repository
In your system type this commands to Initialize a git repo, Connect and push to a GitHub
>> git init
>> git add .
>> git commit -m "...."
>> git branch -M main
>> git remote add origin https://github.com/Vinodhakumara/Test_Ansible_Galaxy.git
>> git push -u origin main
After running the above command your all role file will be pushed to the GitHub repo.
Now go to your ansible-galaxy page and there click on My content and after that click on Add content then select import role from GitHub and after that search for repo name in which your role exists
Click on import GitHub repo and “Ok” then search for ansible role repository select and click ok
Here It’s showing logs of our roles
Below we can see that our role is successfully pushed to an Ansible-Galaxy
By clicking on test_ansible_galaxy that redirect to a role using the below command can be downloaded
That’s it we have successfully pushed our role into ansible-galaxy.
Here is a link for this Ansible-Role: click here
Few more Roles in Ansible Galaxy:
To improve Quality Score make sure you follow the below steps
No empty lines
No extra spaces between Hyphen(-) and word
Try to avoide shell and command module
Don’t leave empty lines More than two lines(2>0)
Don’t Use unwanted spaces
Guys, here we come to the end of this blog I hope you all like it and found it informative. If have any query feel free to reach me
Vinodha kumara - Openshift - ARTH - The School of Technologies | LinkedIn
View Vinodha kumara's profile on LinkedIn, the world's largest professional community. Vinodha has 2 jobs listed on…