diff --git a/changelogs/fragments/8383-deprecate-gitlab-basic-auth.yml b/changelogs/fragments/8383-deprecate-gitlab-basic-auth.yml new file mode 100644 index 0000000000..b9c35cd0e4 --- /dev/null +++ b/changelogs/fragments/8383-deprecate-gitlab-basic-auth.yml @@ -0,0 +1,2 @@ +deprecated_features: + - "gitlab modules - the basic auth method on GitLab API have been deprecated and will be removed in community.general 10.0.0 (https://github.com/ansible-collections/community.general/pull/8383)." diff --git a/plugins/module_utils/gitlab.py b/plugins/module_utils/gitlab.py index b1354d8a9d..224789a71e 100644 --- a/plugins/module_utils/gitlab.py +++ b/plugins/module_utils/gitlab.py @@ -115,6 +115,11 @@ def gitlab_authentication(module, min_version=None): # Changelog : https://github.com/python-gitlab/python-gitlab/releases/tag/v1.13.0 # This condition allow to still support older version of the python-gitlab library if LooseVersion(gitlab.__version__) < LooseVersion("1.13.0"): + module.deprecate( + "GitLab basic auth is deprecated and will be removed in next major version, " + "using another auth method (API token or OAuth) is strongly recommended.", + version='10.0.0', + collection_name='community.general') gitlab_instance = gitlab.Gitlab(url=gitlab_url, ssl_verify=verify, email=gitlab_user, password=gitlab_password, private_token=gitlab_token, api_version=4) else: