galaxy: Failed to get data from the API server: HTTP Error 403: Forbidden

Bug Report

SUMMARY

galaxy API returns 403 and fails to install role

ansible-galaxy --version
ansible-galaxy 2.8.2
STEPS TO REPRODUCE
ansible-galaxy install nusenu.relayor
 [WARNING]: - nusenu.relayor was NOT installed successfully: Failed to get data from the API server
(https://galaxy.ansible.com/api/): HTTP Error 403: Forbidden

ERROR! - you can use --ignore-errors to skip failed roles and finish processing the list.
EXPECTED RESULTS

The role should be downloaded and installed

ACTUAL RESULTS

see above

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 2
  • Comments: 17 (3 by maintainers)

Most upvoted comments

@stevenengland In my case the issue was the following: the Galaxy service has migrated to Galaxy NG but that did not migrate the access token information for the old Galaxy account. Thus my old token set in ansible.cfg did not work and that caused the issue. Once I have figured that out, I created the new token for Galaxy NG and added it to ansible.cfg and the issue was solved. Hope this may help someone too.

Getting the same error in GitHub Actions. Worked 2 months ago:

Run ansible-galaxy --version
ansible-galaxy [core 2.15.5]
  config file = None
  configured module search path = ['/home/runner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/hostedtoolcache/Python/3.9.1[8]/x64/lib/python3.[9](https://github.com/Keeper-Security/secrets-manager-cli-binaries/actions/runs/6673236069/job/18138473055#step:14:10)/site-packages/ansible
  ansible collection location = /home/runner/.ansible/collections:/usr/share/ansible/collections
  executable location = /opt/hostedtoolcache/Python/3.9.18/x64/bin/ansible-galaxy
  python version = 3.9.18 (main, Aug 28 2023, 08:38:32) [GCC [11].4.0] (/opt/hostedtoolcache/Python/3.9.18/x64/bin/python3)
  jinja version = 3.1.2
  libyaml = True
Run ansible-galaxy collection publish ksm-1.2.1.tar.gz --token ***
ansible-galaxy collection publish ksm-1.[2].1.tar.gz --token ***
shell: /usr/bin/bash -e {0}
env:
  pythonLocation: /opt/hostedtoolcache/Python/[3].9.18/x6[4]
  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.18/x[6]4/lib

ERROR! Error when finding available api versions from default (https://galaxy.ansible.com/) (HTTP Code: 403, Message: Forbidden)
Error: Process completed with exit code 1.

Same issue for me when using AWX 23.3.1 and/or 23.4.0, I have followed @drew1kun suggestion of creating an access token and that did the trick