307 Temporary Redirect when trying to import role into Galaxy NG via CLI

  • Following the instructions from the new guide, and using a few API key, I see this error instead of the normal successful import message. This occurs whether I use a valid user or not, such as “kso512” or “kso512fail” so I don’t think it’s getting that far:
$ ansible-galaxy role import -vvvvv kso512 "https://github.com/kso512/checkmk_server"
ansible-galaxy [core 2.14.10]
  config file = /srv/nfs/in/git/projects/kso512/checkmk_server/ansible.cfg
  configured module search path = ['/home/kso/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /home/kso/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible-galaxy
  python version = 3.11.6 (main, Oct  6 2023, 05:26:17) [GCC 13.2.0] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True
Using /srv/nfs/in/git/projects/kso512/checkmk_server/ansible.cfg as config file
Initial connection to galaxy_server: https://beta-galaxy.ansible.com/api/
Opened /home/kso/.ansible/galaxy_token
Calling Galaxy at https://beta-galaxy.ansible.com/api/
Found API version 'v3, pulp-v3, v1' with Galaxy server beta (https://beta-galaxy.ansible.com/api/)
Calling Galaxy at https://beta-galaxy.ansible.com/api/v1/imports/
ERROR! None (HTTP Code: 307, Message: Temporary Redirect)

$ ansible --version
ansible [core 2.14.10]
  config file = /srv/nfs/in/git/projects/kso512/checkmk_server/ansible.cfg
  configured module search path = ['/home/kso/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /home/kso/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.11.6 (main, Oct  6 2023, 05:26:17) [GCC 13.2.0] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True

$ cat ansible.cfg
# Needed to import into new Galaxy NG Beta:
[galaxy]
server_list = beta

[galaxy_server.beta]
url = https://beta-galaxy.ansible.com/api/
token = REDACTED

That document needs to be updated, but the correct server url should be galaxy.ansible.com or no url set in the config.

1 Like

Thanks James!

Here’s the documentation I was referring to, that points everyone to beta-galaxy.ansible.com; linked at the top of the new Galaxy NG - User Guide - Galaxy NG

After pointing to just galaxy.ansible.com, I got the error referred to in this post, which I think I fixed by just calling the short name of the repo instead of the whole URL. That lead me to the error in this post, and after removing the “namespace” line from my meta file, I get this error which says it’s already been imported under a very old tag (“1.0.9” when the latest from today is “1.0.62”):

$ ansible-galaxy role import -vvvvv kso512 checkmk_server
ansible-galaxy [core 2.14.10]
  config file = /srv/nfs/in/git/projects/kso512/checkmk_server/ansible.cfg
  configured module search path = ['/home/kso/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /home/kso/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible-galaxy
  python version = 3.11.6 (main, Oct  8 2023, 05:06:43) [GCC 13.2.0] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True
Using /srv/nfs/in/git/projects/kso512/checkmk_server/ansible.cfg as config file
Initial connection to galaxy_server: https://galaxy.ansible.com/api/
Opened /home/kso/.ansible/galaxy_token
Calling Galaxy at https://galaxy.ansible.com/api/
Found API version 'v3, pulp-v3, v1' with Galaxy server beta (https://galaxy.ansible.com/api/)
Calling Galaxy at https://galaxy.ansible.com/api/v1/imports/
Successfully submitted import request 2051411624525555067319261416874510038
Calling Galaxy at https://galaxy.ansible.com/api/v1/imports?id=2051411624525555067319261416874510038
running
Calling Galaxy at https://galaxy.ansible.com/api/v1/imports?id=2051411624525555067319261416874510038
kso512.checkmk_server 1.0.9 has already been imported
  File "/venv/lib64/python3.11/site-packages/pulpcore/tasking/tasks.py", line 66, in _execute_task
    result = func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^
  File "/app/galaxy_ng/app/api/v1/tasks.py", line 145, in legacy_role_import
    raise Exception(msg)

This also seems to be happening here.