Getting around with Ansible Galaxy.
What you should try to look after when writing your own role before submitting it to Galaxy, some high-quality roles examples and some facts on Galaxy at the moment.
5. ansible-galaxy
¢ init sets up the skeleton of the role
¢ info queries Galaxy API to fetch info about a role
¢ install pulls down a role from Galaxy and installs it
¢ list shows installed roles and their versions
¢ remove rm-rf gracefully removes a role
5
6. You¨re just starting but you wanna help?
¢ Look for a role on ^Galaxy ̄ before starting
from scratch => great time saver
¢ Review the role (mention what doesn¨t work /
isn¨t clear or simply give kudos) => it helps a
lot!
6
7. Calling proficient ansiblings: share your roles!
¢ don¨t assume anything
¢ use git tags as role versions (integrates nicely with Galaxy)
¢ don¨t forget: it¨s just a role, so no inventories or playbooks
¢ prefix the vars with rolename_ (ensures no conflicts)
¢ if your role relies on other roles, use meta/main.yml to
specify the roles dependencies; requirements.yml is a
bonus
¢ consistent naming: github repo name == galaxy role name
¢ use Ansible itself to do unit tests through Jenkins / Travis
(with Ansible¨s assert module) 7
8. Some great roles that I re-use often
¢ ANXS.generic-users
¢ geerlingguy.apache
¢ jdauphant.nginx
¢ f500.elasticsearch
¢ lesmyrmidons.mongodb
¢ graylog2.graylog
¢ geerlingguy.solr
¢ geerlingguy.java
¢ etc. 8
10. Closing words
When installing Galaxy roles, specify the
version so that you won¨t run into regressions
when the maintainer pushes new versions =>
predictability
10
11. Closing words
When you write a role that has other Galaxy
roles dependencies, don¨t try to overwrite the
other roles¨ vars in your role;
your role should only have vars for itself =>
instruct the user to define / include vars in the
playbook or pass them as extra vars
11