community.general.gitlab_group (0.2.1) — module

Creates/updates/deletes GitLab Groups

Authors: Werner Dijkerman (@dj-wasabi), Guillaume Martinez (@Lunik)

Install collection

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


Add to requirements.yml

  collections:
    - name: community.general
      version: 0.2.1

Description

When the group does not exist in GitLab, it will be created.

When the group does exist and state=absent, the group will be deleted.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "Delete GitLab Group"
  gitlab_group:
    api_url: https://gitlab.example.com/
    api_token: "{{ access_token }}"
    validate_certs: False
    name: my_first_group
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: "Create GitLab Group"
  gitlab_group:
    api_url: https://gitlab.example.com/
    validate_certs: True
    api_username: dj-wasabi
    api_password: "MySecretPassword"
    name: my_first_group
    path: my_first_group
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# The group will by created at https://gitlab.dj-wasabi.local/super_parent/parent/my_first_group
- name: "Create GitLab SubGroup"
  gitlab_group:
    api_url: https://gitlab.example.com/
    validate_certs: True
    api_username: dj-wasabi
    api_password: "MySecretPassword"
    name: my_first_group
    path: my_first_group
    state: present
    parent: "super_parent/parent"

Inputs

    
name:
    description:
    - Name of the group you want to create.
    required: true
    type: str

path:
    description:
    - The path of the group you want to create, this will be api_url/group_path
    - If not supplied, the group_name will be used.
    type: str

state:
    choices:
    - present
    - absent
    default: present
    description:
    - create or delete group.
    - Possible values are present and absent.
    type: str

parent:
    description:
    - Allow to create subgroups
    - Id or Full path of parent group in the form of group/name
    type: str

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

api_token:
    description:
    - GitLab token for logging in.
    type: str

visibility:
    choices:
    - private
    - internal
    - public
    default: private
    description:
    - Default visibility of the group
    type: str

description:
    description:
    - A description for the group.
    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 SSL certs when supplying a https endpoint.
    type: bool

Outputs

error:
  description: the error message returned by the GitLab API
  returned: failed
  sample: '400: path is already in use'
  type: str
group:
  description: API object
  returned: always
  type: dict
msg:
  description: Success or failure message
  returned: always
  sample: Success
  type: str
result:
  description: json parsed response from the server
  returned: always
  type: dict