Skip to content

Instantly share code, notes, and snippets.

@wtfred
wtfred / GitlabCiAnsibleGalaxyGitRepository.md
Last active January 10, 2024 19:15
Using same requirements.yml in gitlab-ci with roles in private git repositories, using tokens

I had a problem using ansible / ansible-galaxy to install roles from a requirements.yml file.

My roles are listed like this:

- src: git+ssh://git@gitlab.domain.lan/ansible/roles/my_role.git
  version: "v1.0.0"

This is working fine when running ansible-galaxy install -r requirements.yml on a host which have permission on the role repository (with a pair of ssh keys)

In Gitlab you can't define a "Deploy key" at group level, so i needed to use a token instead.