ansible.builtin.gitlab_group (v2.9.27) — module

Creates/updates/deletes GitLab Groups

| "added in version" 2.1 of ansible.builtin"

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

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.27

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:
    server_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:
    server_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:
    server_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 server_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
    version_added: '2.8'
    version_added_collection: ansible.builtin

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

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

login_user:
    description:
    - GitLab user name.
    type: str

server_url:
    description:
    - The URL of the GitLab server, with protocol (i.e. http or https).
    type: str

visibility:
    choices:
    - private
    - internal
    - public
    default: private
    description:
    - Default visibility of the group
    type: str
    version_added: '2.8'
    version_added_collection: ansible.builtin

description:
    description:
    - A description for the group.
    type: str
    version_added: '2.7'
    version_added_collection: ansible.builtin

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

login_password:
    description:
    - GitLab password for login_user
    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