0

I have Ansible roles packed and uploaded in JFrog Artifactory. Username and password or username and identity token (passed as password) need to be provided to download files. When I download any files from Artifactory, I need to set force_basic_auth: true in the module ansible.builtin.get_url (username and password are also provided), otherwise Artifactory returns 404 error.

My problem is when I try to install the above mentioned role with ansible-galaxy, I can specify the credentials as part of the URL, but cannot set force_basic_auth: true.

My command is:

ansible-galaxy install -r requirements.yml

requirements.yml:

- src: https://<username>:<password>@artifactory.mycompany.com/artifactory/repo/namespace/component/version/component-version.tar.gz
  name: component

How could I install the role hosted in Artifactory?

I edited ansible/module_utils/urls.py to set force_basic_auth=True before making the request. That made the installation work.

Download with cUrl also works using the same URL.

curl https://<username>:<password>@artifactory.mycompany.com/artifactory/repo/namespace/component/version/component-version.tar.gz -o role.tar.gz
TylerH
  • 20,799
  • 66
  • 75
  • 101
Balázs
  • 496
  • 3
  • 8
  • What repo type are you using to store the role ? Is it generic one ? – ALex_hha Apr 12 '23 at 11:50
  • @ALex_hha, currently it is in a Maven repo, so it can be together with the Maven artifacts. Other option would be the generic repo type. – Balázs Apr 12 '23 at 11:52

0 Answers0