Git credentials for private ansible collection?

950 views
Skip to first unread message

Howard Jones

unread,
Jan 19, 2021, 3:56:48 AM1/19/21
to awx-p...@googlegroups.com
We run awx in a kubernetes cluster, and have some local ansible modules
we want to use with it. I've made those into a Collection, and put that
into our internal git repos (Azure Devops).

Now I'm trying to convince awx to actually install them! If I package
the collection up as a tarball (using ansible-galaxy collection build)
and put it on some random http server, it will fetch it OK. Supposedly I
can also use a format like this in the requirements.yml file:

 - name:
https://MyOrgan...@dev.azure.com/MyOrganisation/MyProject/our-ansible-collection.git
    type: git
    version: main

The error I'm getting is that it's not a valid tar file. It's not clear
if it's successfully downloading the file though. It doesn't look like
awx passes any special credentials to galaxy, and the downloaded file
appears to only be a few hundred bytes in size (according to the error
dump).

Does anyone else already do this?

dsaf

unread,
Jan 19, 2021, 11:24:26 AM1/19/21
to AWX Project
try something like this:

```
- name: g...@github.com:ORG/REPO.git,main
```

Howard Jones

unread,
Jan 19, 2021, 11:54:59 AM1/19/21
to awx-p...@googlegroups.com
On 19/01/2021 16:24, dsaf wrote:
> try something like this:
>
> ```
> - name: g...@github.com:ORG/REPO.git,main
> ```
OK, but what ssh key will that use? It's not a public repo.

dsaf

unread,
Jan 19, 2021, 12:00:15 PM1/19/21
to AWX Project
Whichever one you set as the “SCM CREDENTIAL” on the project settings. 

Howard Jones

unread,
Jan 20, 2021, 7:32:14 AM1/20/21
to awx-p...@googlegroups.com
On 19/01/2021 16:24, dsaf wrote:
> try something like this:
>
> ```
> - name: g...@github.com:ORG/REPO.git,main
> ```


ERROR! Invalid collection name 'g...@github.com:ORG/REPO.git,main', name
must be in the format <namespace>.<collection>. Please make sure
namespace and collection name contains characters from [a-zA-Z0-9_] only.

even with `type: git` beneath it. So I don't think it is recognising it
as a git repo

Same for this, which is what works to actually clone the repo in question:

name: g...@ssh.dev.azure.com:v3/ORG/PROJECT/repo


Howard Jones

unread,
Jan 28, 2021, 7:52:55 AM1/28/21
to AWX Project
I had some time to look at this again. In ansible-galaxy 2.10 on my desktop, this works:

  - name: g...@ssh.dev.azure.com:v3/MyOrg/MyProject/repo-name
    type: git
    version: HEAD

With awx 15.01 (comes with Ansible 2.9) it doesn't recognise that as a valid collection name.

Also, I think I *have* to use SSH for the project, since nothing in awx is passing credentials to galaxy, so it would only be whatever ssh key is set up to sync the project.

So back to venvs to get a newer ansible, I guess.
Reply all
Reply to author
Forward
0 new messages