community.general.gitlab_project_members (2.5.9) — module

Manage project members on GitLab Server

| "added in version" 2.2.0 of community.general"

Authors: Sergey Mikhaltsov (@metanovii), Zainab Alsaffar (@zanssa)

Install collection

Install with ansible-galaxy collection install community.general:==2.5.9


Add to requirements.yml

  collections:
    - name: community.general
      version: 2.5.9

Description

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

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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

Inputs

    
state:
    choices:
    - present
    - absent
    default: present
    description:
    - State of the member in the project.
    - On C(present), it adds a user to a GitLab project.
    - On C(absent), it removes a user from a GitLab project.
    type: str

api_url:
    description:
    - The resolvable endpoint for the API.
    type: str

project:
    description:
    - The name (or full path) of the GitLab project the member is added to/removed from.
    required: true
    type: str

api_token:
    description:
    - A personal access token to authenticate with the GitLab API.
    required: true
    type: str

gitlab_user:
    description:
    - The username of the member to add to/remove from the GitLab project.
    required: true
    type: str

access_level:
    choices:
    - guest
    - reporter
    - developer
    - maintainer
    description:
    - The access level for the user.
    - Required if I(state=present), user state is set to present.
    type: str

api_password:
    description:
    - The password to use for authentication against the API.
    type: str

api_username:
    description:
    - The username to use for authentication against the API.
    type: str

validate_certs:
    default: true
    description:
    - Whether or not to validate TLS/SSL certificates when supplying a HTTPS endpoint.
    - Should only be set to C(false) if you can guarantee that you are talking to the
      correct server and no man-in-the-middle attack can happen.
    type: bool