community.general.gitlab_group module – Creates/updates/deletes GitLab Groups
Note
This module is part of the community.general collection (version 10.0.1).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.general
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: community.general.gitlab_group
.
Synopsis
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
The below requirements are needed on the host that executes this module.
python-gitlab python module
requests (Python library https://pypi.org/project/requests/)
Parameters
Parameter |
Comments |
---|---|
GitLab CI job token for logging in. |
|
GitLab OAuth token for logging in. |
|
The password to use for authentication against the API. |
|
GitLab access token with API permissions. |
|
The resolvable endpoint for the API. |
|
The username to use for authentication against the API. |
|
Default to Auto DevOps pipeline for all projects within this group. Choices:
|
|
Absolute path image to configure avatar. File size should not exceed 200 kb. This option is only used on creation, not for updates. |
|
The CA certificates bundle to use to verify GitLab server certificate. |
|
All merge requests and commits are made against this branch unless you specify a different one. |
|
A description for the group. |
|
Only available for top level groups. Choices:
|
|
Force delete group even if projects in it. Used only when Choices:
|
|
Projects in this group can use Git LFS. Choices:
|
|
Enforce GitLab Duo features for all subgroups. Only available for top level groups. Choices:
|
|
Users cannot be added to projects in this group. Choices:
|
|
Group mentions are disabled. Choices:
|
|
Name of the group you want to create. |
|
Allow to create subgroups Id or Full path of parent group in the form of group/name |
|
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. |
|
Prevent forking outside of the group. Choices:
|
|
Members cannot invite groups outside of this group and its subgroups. Only available for top level groups. Choices:
|
|
Determine if developers can create projects in the group. Choices:
|
|
Users can request access (if visibility is public or internal). Choices:
|
|
Require all users in this group to setup two-factor authentication. Choices:
|
|
Service account token expiration. Changes will not affect existing token expiration dates. Only available for top level groups. Choices:
|
|
Projects cannot be shared with other groups. Choices:
|
|
create or delete group. Possible values are present and absent. Choices:
|
|
Allowed to create subgroups. Choices:
|
|
Delay 2FA enforcement (hours). |
|
Whether or not to validate SSL certs when supplying a HTTPS endpoint. Choices:
|
|
Default visibility of the group Choices:
|
|
Choices:
|
Attributes
Attribute |
Support |
Description |
---|---|---|
Support: full |
Can run in |
|
Support: none |
Will return details on what has changed (or possibly needs changing in |
Examples
- name: "Delete GitLab Group"
community.general.gitlab_group:
api_url: https://gitlab.example.com/
api_token: "{{ access_token }}"
name: my_first_group
state: absent
- name: "Create GitLab Group"
community.general.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
# The group will by created at https://gitlab.dj-wasabi.local/super_parent/parent/my_first_group
- name: "Create GitLab SubGroup"
community.general.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"
# Other group which only allows sub-groups - no projects
- name: "Create GitLab Group for SubGroups only"
community.general.gitlab_group:
api_url: https://gitlab.example.com/
validate_certs: true
api_username: dj-wasabi
api_password: "MySecretPassword"
name: my_main_group
path: my_main_group
state: present
project_creation_level: noone
auto_devops_enabled: false
subgroup_creation_level: maintainer
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
the error message returned by the GitLab API Returned: failed Sample: |
|
API object Returned: always |
|
Success or failure message Returned: always Sample: |
|
json parsed response from the server Returned: always |