People have been asking, “what’s the best way to reuse Ansible content”. The answer of course is roles - We built roles in Ansible 1.2 - http://ansibleworks.com/docs/playbooks_roles.html#roles. Role dependencies and defaults were added shortly thereafter in 1.3.
But how do we share roles?
We thought about this a lot and built … AnsibleWorks Galaxy. If you were at AnsibleFest in San Francisco you got an early preview from James Cammarata, though we’ve since retooled many things from the ground up! What’s Galaxy? Ansible Galaxy is an automation content site designed from the ground up with an emphasis on being very dynamic — offering up a lot of new ways to find content.
Why is it called Galaxy? To us, Ansible is sort of like the Mos Eisley Cantina (we assume you have seen the original Star Wars, if not, please rectify this ASAP). We’re just one spot on one planet. All the content and diaspora in the Ansible community, all that we create, compromises the Galaxy.
Galaxy is structured around roles. You download the roles you like, then you write very simple play books that assemble all the roles together with roles you also write yourself. Roles can contain tasks, default variables, all you want, and special metadata provided in the role instructs Galaxy about how to display it, along with a README.
Galaxy has a lot of neat features which you should be able to explore pretty quick.
At the initial phase, we’ve made signup as painless as we could — you can login with a local account, but you can also login with OAuth from Twitter, GitHub, or Google+. (We just use this for login, so we won’t tweet for you or anything). You can also link social accounts later if you sign up first with a local account, but we expect social auth is the way to go for many of you.
Once you log in, from the “Explore” page, you can see not only the top roles in each category, but also the top reviewers, top authors, new roles, and new authors. You can browse the users arbitrarily and see what they have contributed and reviewed.
When we started Galaxy, a lot of our design influences were from consumer sites — things like iTunes, Flickr (Explore), and most significantly … beeradvocate.com! For this reason you’ll see linked reviews and ratings, ratings with structure, and highlighted reviews from AnsibleWorks employees. It’s designed to help you find what’s good very very clearly, and explore other things you might be interested in.
Once you find something you like, the roles detail page will tell you what command line to use to install it.
There’s a command line tool that’s embedded in Ansible 1.4.2 — which is incidentally on PyPi *exactly right now* and a pip install away, or otherwise available on http://ansibleworks.com/releases/ — and will soon make it’s way to the distributions.
This is all documented on the “About/Help” page of galaxy, but the command line tool can help set you up with a scaffold of a new role, and can also download roles and dependencies. The ansible-galaxy CLI is of course open source, so it can take pull requests and get much smarter (I’ve heard some nice requests for things like storing previous versions), but we’d probably enjoy a discussion on firstname.lastname@example.org first as it’s still pretty new and we would want to reduce duplicate efforts!
Galaxy is all backed by GitHub, so to share a new role, all you need to do is a host a GitHub repository as instructed on the “About/Help” page of Galaxy, and then log in, and hit “Add Role”. (You can also have versions of roles by using tags on the repo, if you want!)
We should also point out that our RESTful API is fully browse-able too! Go to http://galaxy.ansibleworks.com/api to see for yourself! You may also enjoy watching Firebug as you are using the web application. If you like the API, you may wish to know it shares a lot in common with the API design and UI of AWX - http://ansibleworks.com/ansibleworks-awx, which provides not only a UI and central server solution for Ansible, but also a great API for embedding. Both use Angular.js and are powered by Bootstrap, which we both pretty much love for frontend development.
Galaxy will get some refreshes periodically and is currently in “beta”, so let us know what your thoughts and ideas! Beta just means there may be some kinks not worked out — and we may be revising the interface some. All your role data you upload will stay there even as it goes out of beta, and that applies to reviews and comments as well.
Galaxy comes to you mostly through a lot of hard work from two great AnsbileWorks engineers — James Cammarata and Chris Houseknecht, so thanks very much to both of them for this — and thanks to all of you for waiting so long for this, we wanted to take time to do it right, and hope you really like it. Of course, we’re not done either! Please take a look and let us know your thoughts by commenting on the ansible-project mailing list!