First public ansible role

Recently i wrote about first steps with ansible. Meanwhile continue working with ansible and recently started second project that uses ansible as well and suddenly i realized that some roles look very simmilar and could be reused. This is easy if your roles are small and do one thing, but do it well (UNIX style).

public role aholbreich.maven

aholbreich.maven - is my first public role. That role installs maven on your machine. For now i have choose not to wire it to any java role as dependency. Just keep in mind maven needs java of course.

Now this role can be installed and used on every ansible control machine i need.

$ansible-galaxy install aholbreich.maven 

installs that maven role. And here is the usage example in a playbook.

- hosts: jenkins
  roles:
    - { role: aholbreich.maven }

If no variables (re)defined, maven version 3.3.9 will be installed and configured.

Dependencies list

If project grows your list on installed modules grow as well, so you want to track and install them together.

Likely you can do it by having a dependency list e.g requirements.yml looking like:

 - src: aholbreich.maven
 - src: aholbreich.java
...

and install all listed dependencies at once with.

ansible-galaxy install -r requirements.yml  

Bur there is even more... For example you can install dependencies from different sources like github, bitbuicket and file system directly.
This is really powerful concept, so think about sharing roles and reuse existing ones.

Hope this encourages someone you to use galaxy too.
Feel free to give your feedback here or on github