gitlab_group – Creates/updates/deletes Gitlab Groups¶
New in version 2.1.
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 >= 2.7
python-gitlab python module <= 1.12.1
Parameters¶
Parameter | Choices/Defaults | Comments |
---|---|---|
api_password
string
|
The password to use for authentication against the API
|
|
api_token
string
|
Gitlab token for logging in.
aliases: login_token |
|
api_url
string
|
The resolvable endpoint for the API
|
|
api_username
string
|
The username to use for authentication against the API
|
|
description
string
added in 2.7 |
A description for the group.
|
|
login_password
string
|
Gitlab password for login_user
|
|
login_user
string
|
Gitlab user name.
|
|
name
string
/ required
|
Name of the group you want to create.
|
|
parent
string
added in 2.8 |
Allow to create subgroups
Id or Full path of parent group in the form of group/name
|
|
path
string
|
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.
|
|
server_url
string
|
The URL of the GitLab server, with protocol (i.e. http or https).
|
|
state
string
|
|
create or delete group.
Possible values are present and absent.
|
validate_certs
boolean
|
|
Whether or not to validate SSL certs when supplying a https endpoint.
|
visibility
string
added in 2.8 |
|
Default visibility of the group
|
Examples¶
- 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
- name: "Create Gitlab Group"
gitlab_group:
api_url: https://gitlab.example.com/
validate_certs: True
api_usersername: 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"
gitlab_group:
api_url: https://gitlab.example.com/
validate_certs: True
api_usersername: dj-wasabi
api_password: "MySecretPassword"
name: my_first_group
path: my_first_group
state: present
parent: "super_parent/parent"
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
error
string
|
failed |
the error message returned by the Gitlab API
Sample:
400: path is already in use
|
group
dictionary
|
always |
API object
|
msg
string
|
always |
Success or failure message
Sample:
Success
|
result
dictionary
|
always |
json parsed response from the server
|
Status¶
This module is not guaranteed to have a backwards compatible interface. [preview]
This module is maintained by the Ansible Community. [community]