How To Push Your Role In Ansible-Galaxy

Gupta Aditya
4 min readMar 27, 2021

Hey guys hope you all are doing good today we are going to see how can we push our role to ansible-galaxy so everyone else can use our role. 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.

First of all, you have to go to the below ansible-galaxy link and login with your Github account.

Once logged in you can see your GitHub username as shown below.

That's it you can now push your role to ansible-galaxy and share it will your team.

Now got you master node where you have created an ansible role and in that system, you must have git installed so that we can push our role to Github.

yum whatprovies git=> to check check from which command you can download git in rhel8

Note:- if you are using rhel 8 git available in DVD repo so configure that and you can use tum install git to install git.

After creating the role go inside the role folder and follow the following steps

git init
git add .
git commit . -m"any commit msg you want"

After the above steps go to your git hub account and create the public repo of any name suggested should be matching with your role name as shown below.

Make sure you have not checked add a readme file and all etc.

git remote add origin "your repo url"
eg:- git remote add origin https://github.com/guptaadi123/testing-role.git
git branch -M master
git push -u origin master=> after this give your github user name and password

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.

As soon as you select repo ansible-galaxy automatically take a second to process it and show you screen as shown below,

Once you see msg like the above on the screen just click on import. Now you can check your import in the My import tab.

That's it we have successfully pushed our role into ansible-galaxy.

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 :)

Guys follow me for such amazing blogs and if have any review then please let me know I will keep those points in my mind next time while writing blogs. If want to read more such blog to know more about me here is my website link https://sites.google.com/view/adityvgupta/home.Guys Please do not hesitate to keep 👏👏👏👏👏 for it (An Open Secret: You can clap up to 50 times for a post, and the best part is, it wouldn’t cost you anything), also feel free to share it across. This really means a lot to me.

--

--