diff --git a/changelogs/fragments/deprecate-v2-galaxy-api.yml b/changelogs/fragments/deprecate-v2-galaxy-api.yml new file mode 100644 index 00000000000..a0513da5063 --- /dev/null +++ b/changelogs/fragments/deprecate-v2-galaxy-api.yml @@ -0,0 +1,2 @@ +bugfixes: +- ansible-galaxy - Deprecate use of the Galaxy v2 API (https://github.com/ansible/ansible/issues/81781) diff --git a/lib/ansible/galaxy/api.py b/lib/ansible/galaxy/api.py index ad340415867..156dd4cf700 100644 --- a/lib/ansible/galaxy/api.py +++ b/lib/ansible/galaxy/api.py @@ -133,6 +133,15 @@ def g_connect(versions): % (method.__name__, ", ".join(versions), ", ".join(available_versions), self.name, self.api_server)) + # Warn only when we know we are talking to a collections API + if common_versions == {'v2'}: + display.deprecated( + 'The v2 Ansible Galaxy API is deprecated and no longer supported. ' + 'Ensure that you have configured the ansible-galaxy CLI to utilize an ' + 'updated and supported version of Ansible Galaxy.', + version='2.20' + ) + return method(self, *args, **kwargs) return wrapped return decorator