Skipping Galaxy server https://galaxy.ansible.com/api/

Hello,
since last weekend, suddenly (nothing was changed on our side), we started to get that error, when running “Project Update” in Ansible AWX 23.2.0:

"[WARNING]: Skipping Galaxy server https://galaxy.ansible.com/api/. Got an",
    "unexpected error when getting available versions of collection",
    "community.general: '/api/v3/plugin/ansible/content/published/collections/index/",
    "community/general/versions/'",
    "ERROR! Unexpected Exception, this is probably a bug: '/api/v3/plugin/ansible/content/published/collections/index/community/general/versions/'"

Sample of the requirements.yml (different version of the collection were tested and all got the same error):

collections:
  - name: community.general
    version: 7.0.1
  - name: community.windows
    version: 2.0.0

We tried to run the same on a local container build only to troubleshoot the problem and got the same error. We did deploy another different version of AWX and got the same error.

We did check, and the URL '/api/v3/plugin/ansible/content/published/collections/index/community/general/versions/' is correct.
There is no any issue, if we run ansible-galaxy collection install community.general. That worked.

Important: the issue is not for all collections. For example, when the community.general is commented on, the community.windows is installed with no issues. If the community.general is not commented on, we get that error and the process fails.

Maybe someone knows what is wrong and can help.

2 Likes

Thanks for reporting and giving detailed information, I am investigating this issue.

1 Like

@veritasium @rochacbruno We started to notice the same issue on our AWX instance. It seems when we used version: with the latest version everything started to work.

This is the error message we were getting.

{
    "msg": "non-zero return code",
    "cmd": [
        "ansible-galaxy",
        "collection",
        "install",
        "-r",
        "requirements.yml",
        "-p",
        "/tmp/awx_573370_63xlw131/requirements_collections"
    ],
    "stdout": "Process install dependency map\n|\b/\b-\b\\\b|\b/\b-\b\\\b",
    "stderr": "ERROR! Unknown error when attempting to call Galaxy at '/api/v3/plugin/ansible/content/published/collections/index/theforeman/foreman/versions/?limit=10&offset=10': unknown url type: '/api/v3/plugin/ansible/content/published/collections/index/theforeman/foreman/versions/?limit=10&offset=10'",
    "rc": 1,
    "start": "2023-09-30 16:45:22.247874",
    "end": "2023-09-30 16:45:23.507961",
    "delta": "0:00:01.260087",
    "changed": false,
    "invocation": {
        "module_args": {
            "chdir": "/var/lib/awx/projects/_151__REPO/collections",
            "_raw_params": "ansible-galaxy collection install -r requirements.yml -p /tmp/awx_573370_63xlw131/requirements_collections",
            "warn": true,
            "_uses_shell": false,
            "stdin_add_newline": true,
            "strip_empty_ends": true,
            "argv": null,
            "executable": null,
            "creates": null,
            "removes": null,
            "stdin": null
        }
    },
    "stdout_lines": [
        "Process install dependency map",
        "|\b/\b-\b\\\b|\b/\b-\b\\\b"
    ],
    "stderr_lines": [
        "ERROR! Unknown error when attempting to call Galaxy at '/api/v3/plugin/ansible/content/published/collections/index/theforeman/foreman/versions/?limit=10&offset=10': unknown url type: '/api/v3/plugin/ansible/content/published/collections/index/theforeman/foreman/versions/?limit=10&offset=10'"
    ],
    "_ansible_no_log": false
}

I wonder if this issue is related to the New Galaxy that was announced last week. We started to notice this issue on September 30th.

We started to see that error on the last weekend. So, match what you’re describe. Most probably related.

1 Like

We are having same issue trying to install community.aws. Here is verbose output.

10:23:58  Initial connection to galaxy_server: https://galaxy.ansible.com
10:23:58  Created /root/.ansible/galaxy_token
10:23:58  Calling Galaxy at https://galaxy.ansible.com/api/
10:23:58  Found API version 'v3, pulp-v3, v1' with Galaxy server default (https://galaxy.ansible.com/api/)
10:23:58  Calling Galaxy at https://galaxy.ansible.com/api/v3/collections/community/aws/
10:23:58  Calling Galaxy at https://galaxy.ansible.com/api/v3/collections/community/aws/versions/?limit=100
10:23:58  Calling Galaxy at https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/index/community/aws/versions/?limit=100&offset=100
10:23:59  [WARNING]: Skipping Galaxy server https://galaxy.ansible.com/api/. Got an
10:23:59  unexpected error when getting available versions of collection community.aws: '
10:23:59  /api/v3/plugin/ansible/content/published/collections/index/community/aws/versio
10:23:59  ns/'
10:23:59  ERROR! Unexpected Exception, this is probably a bug: '/api/v3/plugin/ansible/content/published/collections/index/community/aws/versions/'
10:23:59  the full traceback was:
10:23:59  
10:23:59  Traceback (most recent call last):
10:23:59    File "/usr/local/lib/python3.9/site-packages/resolvelib/resolvers.py", line 171, in _merge_into_criterion
10:23:59      crit = self.state.criteria[name]
10:23:59  KeyError: 'community.aws'
10:23:59  
10:23:59  During handling of the above exception, another exception occurred:
10:23:59  
10:23:59  Traceback (most recent call last):
10:23:59    File "/usr/local/bin/ansible-galaxy", line 135, in <module>
10:23:59      exit_code = cli.run()
10:23:59    File "/usr/local/lib/python3.9/site-packages/ansible/cli/galaxy.py", line 552, in run
10:23:59      return context.CLIARGS['func']()
10:23:59    File "/usr/local/lib/python3.9/site-packages/ansible/cli/galaxy.py", line 75, in method_wrapper
10:23:59      return wrapped_method(*args, **kwargs)
10:23:59    File "/usr/local/lib/python3.9/site-packages/ansible/cli/galaxy.py", line 1186, in execute_install
10:23:59      self._execute_install_collection(
10:23:59    File "/usr/local/lib/python3.9/site-packages/ansible/cli/galaxy.py", line 1213, in _execute_install_collection
10:23:59      install_collections(
10:23:59    File "/usr/local/lib/python3.9/site-packages/ansible/galaxy/collection/__init__.py", line 512, in install_collections
10:23:59      dependency_map = _resolve_depenency_map(
10:23:59    File "/usr/local/lib/python3.9/site-packages/ansible/galaxy/collection/__init__.py", line 1326, in _resolve_depenency_map
10:23:59      return collection_dep_resolver.resolve(
10:23:59    File "/usr/local/lib/python3.9/site-packages/resolvelib/resolvers.py", line 453, in resolve
10:23:59      state = resolution.resolve(requirements, max_rounds=max_rounds)
10:23:59    File "/usr/local/lib/python3.9/site-packages/resolvelib/resolvers.py", line 318, in resolve
10:23:59      name, crit = self._merge_into_criterion(r, parent=None)
10:23:59    File "/usr/local/lib/python3.9/site-packages/resolvelib/resolvers.py", line 173, in _merge_into_criterion
10:23:59      crit = Criterion.from_requirement(self._p, requirement, parent)
10:23:59    File "/usr/local/lib/python3.9/site-packages/resolvelib/resolvers.py", line 79, in from_requirement
10:23:59      cands = build_iter_view(provider.find_matches([requirement]))
10:23:59    File "/usr/local/lib/python3.9/site-packages/ansible/galaxy/dependency_resolution/providers.py", line 214, in find_matches
10:23:59      coll_versions = self._api_proxy.get_collection_versions(first_req)
10:23:59    File "/usr/local/lib/python3.9/site-packages/ansible/galaxy/collection/galaxy_api_proxy.py", line 101, in get_collection_versions
10:23:59      return set(
10:23:59    File "/usr/local/lib/python3.9/site-packages/ansible/galaxy/collection/galaxy_api_proxy.py", line 101, in <genexpr>
10:23:59      return set(
10:23:59    File "/usr/local/lib/python3.9/site-packages/ansible/galaxy/collection/galaxy_api_proxy.py", line 82, in _get_collection_versions
10:23:59      raise last_error
10:23:59    File "/usr/local/lib/python3.9/site-packages/ansible/galaxy/collection/galaxy_api_proxy.py", line 61, in _get_collection_versions
10:23:59      versions = api.get_collection_versions(requirement.namespace, requirement.name)
10:23:59    File "/usr/local/lib/python3.9/site-packages/ansible/galaxy/api.py", line 126, in wrapped
10:23:59      return method(self, *args, **kwargs)
10:23:59    File "/usr/local/lib/python3.9/site-packages/ansible/galaxy/api.py", line 867, in get_collection_versions
10:23:59      data = self._call_galaxy(to_native(next_link, errors='surrogate_or_strict'),
10:23:59    File "/usr/local/lib/python3.9/site-packages/ansible/module_utils/api.py", line 157, in run_function
10:23:59      return call_retryable_function()
10:23:59    File "/usr/local/lib/python3.9/site-packages/ansible/galaxy/api.py", line 394, in _call_galaxy
10:23:59      path_cache = self._cache[cache_id][url_info.path]
10:23:59  KeyError: '/api/v3/plugin/ansible/content/published/collections/index/community/aws/versions/'

We’re running an older version of Ansible (core 2.11) and getting these errors. I haven’t seen it stated anywhere explicitly but I suspect older Ansible versions aren’t compatible with Galaxy NG.

I have had luck adding this to our ansible.cfg:

[galaxy]
server = https://old-galaxy.ansible.com/

Not an appealing long-term solution, but it gets things working again and buys us time.

3 Likes

So, is it true to say that there is some small incompatibilty between the new Galaxy and AWX? Even the latest one?

@veritasium according to Unexpected exception while installing ansible galaxy collections using Python 3.7 · Issue #81830 · ansible/ansible · GitHub

This issue has been resolved in the following versions of ansible-core:

v2.12.8
v2.13.3
v2.14.0 (and all newer versions)

Can you confirm which version of Ansible Core are you running?

1 Like

@rochacbruno, I tried to find a way how to get it within the AWX containers or from the documentation, but unfortunately, wasnt able to find such details. Maybe someone here knows…

Hi, @aberkvam_twh .
Can you help me please and tell how did you changed it? There is no way to do via GUI, the API doesnt allow to update built-in credentials… We’re using the AWX deployed by latest AWX Operator. In the operator’s YAML, i didnt find any property, which allows to confgiure it. Probably, i am missing something, but not sure what :).

Appreciate in advance.

Ok. I found a way. Adding a new credential of type Ansible Galaxy with the https://old-galaxy.ansible.com/ URL did the job.

Thank you very much.

1 Like

@veritasium,

an option is to create a ansible.cfg file in your project directory.

/my_project
|_ansible.cfg

another option is, if you have a collections folder in your project directory with a requirements.yml.
you can add a source in it.

/my_project
|
|_/collections
|_requirements.yml

requirements.yml

collections:

it worked for me but not a long-term solution because at some point this https://old-galaxy.ansible.com will have EOL.

1 Like

Hi @jeromearellano ,
how could I set the source in galaxy.yml?

dependencies:
  freeipa.ansible_freeipa: '1.11.1'
  community.general: '6.3.0'
  ansible.posix: '1.4.0'
  community.crypto: '2.3.4'
  crowdstrike.falcon: '3.3.3'
  community.hashi_vault: '5.0.0'

You can’t. Or rather, you don’t, which feels a lot like “you can’t”, but the difference is subtle.

Dependencies in a published collection’s galaxy.yml must reference other published collections. But it’s up to the admin installing a published collection to decide the sources from which to retrieve collections to satisfy dependencies. That’s covered in Configuring the ansible-galaxy client.

(By the way, the dependencies you listed are quite restrictive. They require the exact versions specified, whereas you probably want those to be version minimums. Consider ">=1.11.1" rather than '1.11.1' for example.)

I use those in galaxy.yml in order to have the required dependencies automatically installed with one single command when I insall the collection:
ansible-galaxy collection install collection --force --force-with-deps

(We had cases where an updated dependency broke our use. I have a daily pipeline testing with upstream version, every now and then when I make other changes I bimp the versions…)

Fixed for me with the latest AWX, AWX 23.3.0