Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gitlab: authenticate through api_token specified in python-gitlab configuration files #8378

Open
1 task done
antimius opened this issue May 16, 2024 · 5 comments
Open
1 task done
Labels
feature This issue/PR relates to a feature request module module

Comments

@antimius
Copy link

antimius commented May 16, 2024

Summary

We currently are using python-gitlab in several other python scripts and have set it up to use ~/.python-gitlab.cfg as the central source for our credentials (https://python-gitlab.readthedocs.io/en/stable/cli-usage.html#configuration-files). When using the community.general.gitlab_* modules however I have to specify the api_token explicitly. Would it be possible to try and fall back on default python-gitlab.cfg configuration when credentials are not specified?

Issue Type

Feature Idea

Component Name

gitlab_merge_request

Additional Information

- name: Create merge request
  community.general.gitlab_merge_request:
    api_url: "{{ gitlab_url }}"
    project: "{{ gitlab_repository }}"
    source_branch: feat/{{ jira_ticket }}
    target_branch: "{{ gitlab_target_branch }}"

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibullbot
Copy link
Collaborator

Files identified in the description:
None

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot ansibullbot added the feature This issue/PR relates to a feature request label May 16, 2024
@ansibullbot
Copy link
Collaborator

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot ansibullbot added the module module label May 16, 2024
@felixfontein
Copy link
Collaborator

I'm not sure whether using that config file is a good idea, since python-gitlab can be seen as an implementation detail of the modules. (Though it doesn't look like we'll anytime soon change to another library...)

Something that migth simplyify using the modules is adding a module default group (similar to the community.general.consul and community.general.proxmox ones) that allows to set common parameters (like api_token) once in the playbook, and that will then be used by every gitlab_* module for which api_token isn't explicitly specified.

(Obviously also both supporting that config file and having a module defaults group could be implemented, if the module maintainers think that both are a good idea.)

@felixfontein
Copy link
Collaborator

(#8334 shows how to implement a module defaults group, also known as an action group.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This issue/PR relates to a feature request module module
Projects
None yet
Development

No branches or pull requests

3 participants