3

I have a requirements.yml file with the following contents:

- src: git@github.com:SomeOrg/SomeRole.git
  scm: git
  version: master
  name: some-role

If I run ansible-galaxy, the role gets includes in the roles directory as expected. The role ends up being an export of the desired git revision rather than a git repository itself. Is there a way to tell ansible-galaxy to pull in the role as git repository?

Composer, the PHP package manager, does this by default. Having the dependencies you pull in being git repositories where applicable makes it a lot easier to make changes to those.

Jeroen De Dauw
  • 10,321
  • 15
  • 56
  • 79

1 Answers1

3

TLDR; => ansible-galaxy role install -fgr roles/requirements.yml


This is not really clear IMO in the help message but that is the option you are looking for:

$ ansible-galaxy install --help
[...]
  -g, --keep-scm-meta   Use tar instead of the scm archive option when
                        packaging the role.

You will probably want to ignore the meta/.galaxy_install_info file that galaxy is creating upon import inside the role.

Zeitounator
  • 38,476
  • 7
  • 53
  • 66
  • That worked. Not sure how I missed this since I definitely ran the help command before posting here. – Jeroen De Dauw May 22 '20 at 10:07
  • Happens to the best ;) As explained in my answer, I think the doc is not really clear on this option. And I actually went ove it several times while looking for this solution a while ago until I finally tried it and succeeded. – Zeitounator May 22 '20 at 10:12