ansible_logo If like me, you were using the Ansible Galaxy website to find and download your playbook for your favorite apps, you may missed a feature.

It happened to me when I had to manage several playbook roles. I first wanted to use Git submodules to do it. However I preferred to search another way to do like like Puppet can do with R10K because I am working on a project with some unfamiliar Git users. And I preferred to make it as simple as possible.

During a short search, I didn’t find anything really interesting, and looked at all the informations on the Galaxy website. I finally almost find what I was searching for. You can specify a file with role name and version you want to install. The file (galaxy_dep) should looks like this:

jdauphant.nginx,v1.1.1
nbz4live.php-fpm,0.2.0
deimosfr.mysql,v0.1
deimosfr.dotdeb,v0.1

Then you can launch your ansible-galaxy binary with those options to grab your defined roles:

ansible-galaxy install -r galaxy_dep -p roles --force

This will download them in the “roles” folder in the current directory. A missing feature in my opinion is the possibility to rename with a specified name the downloaded roles.

This is a simple solution but I hope this could help you too.