community.general.gitlab_project_members – Manage project members on GitLab Server

Note

This plugin is part of the community.general collection (version 2.5.1).

To install it use: ansible-galaxy collection install community.general.

To use it in a playbook, specify: community.general.gitlab_project_members.

New in version 2.2.0: of community.general

Synopsis

  • This module allows to add and remove members to/from a project, or change a member’s access level in a project on GitLab.

Requirements

The below requirements are needed on the host that executes this module.

  • python-gitlab python module <= 1.15.0

  • owner or maintainer rights to project on the GitLab server

Parameters

Parameter Choices/Defaults Comments
access_level
string
    Choices:
  • guest
  • reporter
  • developer
  • maintainer
The access level for the user.
Required if state=present, user state is set to present.
api_password
string
The password to use for authentication against the API.
api_token
string / required
A personal access token to authenticate with the GitLab API.
api_url
string
The resolvable endpoint for the API.
api_username
string
The username to use for authentication against the API.
gitlab_user
string / required
The username of the member to add to/remove from the GitLab project.
project
string / required
The name of the GitLab project the member is added to/removed from.
state
string
    Choices:
  • present ←
  • absent
State of the member in the project.
On present, it adds a user to a GitLab project.
On absent, it removes a user from a GitLab project.
validate_certs
boolean
    Choices:
  • no
  • yes ←
Whether or not to validate TLS/SSL certificates when supplying a HTTPS endpoint.
Should only be set to false if you can guarantee that you are talking to the correct server and no man-in-the-middle attack can happen.

Notes

Note

  • Supports check_mode.

Examples

- name: Add a user to a GitLab Project
  community.general.gitlab_project_members:
    api_url: 'https://gitlab.example.com'
    api_token: 'Your-Private-Token'
    validate_certs: True
    project: projectname
    gitlab_user: username
    access_level: developer
    state: present

- name: Remove a user from a GitLab project
  community.general.gitlab_project_members:
    api_url: 'https://gitlab.example.com'
    api_token: 'Your-Private-Token'
    validate_certs: False
    project: projectname
    gitlab_user: username
    state: absent

Authors

  • Sergey Mikhaltsov (@metanovii)

  • Zainab Alsaffar (@zanssa)