Quick question and very sorry if this has already been asked or discussed (I had a quick search but couldn’t find anything). Does anyone know if there are any plans to add the functionality to automatically install any missing roles detected, so when a role is not found in the roles_path or relative directory to search ansible-galaxy? E.g. instead of having to provision, see roles are missing, run ansible-galaxy install XX provision again, see another missing role, and repeat until all roles are installed being able to just run a ansible-galaxy install-missing or some such which checks ansible-galaxy when a missing role in detected and automatically installs.
Thanks for any feedback
So the galaxy CLI will install dependencies.
But it is not true that Ansible will auto fetch them, this is a manual step.
You can make a requirements file (list one role per line, and optionally a comma and the version string) and feed that to the ansible-galaxy CLI.
Two of the settings required to use the requirements file are the api server and a public github. I would like to be able to use the requirements file functionality from inside closed networks. Can this work without an api server or can an api server be made available inside a network without internet connectivity? We could patch ansible-galaxy to allow us to supply the url for the github instance. Thoughts?
There is no private galaxy instance available at this time.
I’d be totally open to an option to make it also work off of a mount location, which probably provides the easiest solution.
Can you explain what you mean by working off a mount location? I would assume that most people like us either have an internal github or another git instance where they store their ansible roles. I definitely want to keep my code in github and be able to reference it from the requirements file. As these repos are internal and not meant to be shared there’s really not a reason for us to use an internal ansible-galaxy. Having one would be great but we really just want to be able to reference things in github and pull them down from the requirements file.
I mean being able to install things from the local filesystem.
If you want to make it take git URLs too, that’s great.
I mean we’re not going to build a installable galaxy server yet.
Yeah I don’t think that’s something I would use. I keep my code in github and I just want a way to make a list of remote repositories that contain ansible roles and pull them down. Some of those remote repositories aren’t hosted on the www.github.com site. They’re in private instances of github behind firewalls. I could use git subtrees or submodules but what I would like to be able to do is use ansible-galaxy -r somefile and have it work. Would you accept a patch that made the api-server optional (basically saying we don’t want to use the role sharing social stuff you have going on because we’re behind some firewalls and cant) and the github url a parameter which would allow us to use internal githubs? Are there better ideas? Maybe I’m not understanding what how you envision getting code from githubs to the localfile system. All I want to do is type ansible-galaxy -r filename and hit enter.
I tried installing a role (geerlingguy.drush) with a dependency on another role (geerlingguy.php, geerlingguy.composer), but the dependencies weren’t downloaded; is there anything in particular I’m missing?
I was going to ask this same question (how to get the ansible-galaxy command to download dependencies), but am wondering if I’m going about it the wrong way.
I just used the command “ansible-galaxy install geerlingguy.drush”, and only the .drush role was downloaded.
We’d probably need to see the role’s meta.yml, or perhaps you had updated the file on github and needed to hit the “update” button in Galaxy to suck in the new metadata.
Let us know!
Here’s the role: https://galaxy.ansible.com/list#/roles/433
And here’s meta/main.yml: https://github.com/geerlingguy/ansible-role-drush/blob/master/meta/main.yml
Pasted here:
---
dependencies:
- { role: geerlingguy.git }
- { role: geerlingguy.php }
- { role: geerlingguy.composer }
galaxy_info:
author: geerlingguy
description: Drush - command line shell for Drupal
company: "Midwestern Mac, LLC"
license: "license (BSD, MIT)"
min_ansible_version: 1.4
platforms:
- name: EL
versions:
- all
...
Thanks, I’ll take a look at this today.