community.general.gitlab_project – Creates/updates/deletes GitLab Projects
Note
This plugin is part of the community.general collection (version 3.8.3).
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
.
To use it in a playbook, specify: community.general.gitlab_project
.
Synopsis
When the project does not exist in GitLab, it will be created.
When the project does exists and state=absent, the project will be deleted.
When changes are made to the project, the project will be updated.
Requirements
The below requirements are needed on the host that executes this module.
python >= 2.7
python-gitlab python module
Parameters
Parameter |
Comments |
---|---|
Allow merge when skipped pipelines exist. Choices:
|
|
The password to use for authentication against the API |
|
GitLab token for logging in. |
|
The resolvable endpoint for the API |
|
The username to use for authentication against the API |
|
Custom path to the CI configuration file for this project. |
|
An description for the project. |
|
Id or the full path of the group of which this projects belongs to. |
|
Git repository which will be imported into gitlab. GitLab server needs read access to this git repository. |
|
Whether you want to create issues or not. Possible values are true and false. Choices:
|
|
Enable Git large file systems to manages large files such as audio, video, and graphics files. Choices:
|
|
What requirements are placed upon merges. Possible values are Choices:
|
|
If merge requests can be made or not. Possible values are true and false. Choices:
|
|
The name of the project. |
|
All discussions on a merge request (MR) have to be resolved. Choices:
|
|
Only allow merges if pipeline succeeded. Choices:
|
|
Enable GitLab package repository. Choices:
|
|
The path of the project you want to create, this will be server_url/<group>/path. If not supplied, name will be used. |
|
Remove the source branch after merge. Choices:
|
|
Enable shared runners for this project. Choices:
|
|
If creating snippets should be available or not. Choices:
|
|
Squash commits when merging. Choices:
|
|
Create or delete project. Possible values are present and absent. Choices:
|
|
Used to create a personal project under a user’s name. |
|
Whether or not to validate SSL certs when supplying a https endpoint. Choices:
|
|
Choices:
|
|
If an wiki for this project should be available or not. Choices:
|
Examples
- name: Create GitLab Project
community.general.gitlab_project:
api_url: https://gitlab.example.com/
api_token: "{{ api_token }}"
name: my_first_project
group: "10481470"
- name: Delete GitLab Project
community.general.gitlab_project:
api_url: https://gitlab.example.com/
api_token: "{{ access_token }}"
validate_certs: False
name: my_first_project
state: absent
delegate_to: localhost
- name: Create GitLab Project in group Ansible
community.general.gitlab_project:
api_url: https://gitlab.example.com/
validate_certs: True
api_username: dj-wasabi
api_password: "MySecretPassword"
name: my_first_project
group: ansible
issues_enabled: False
merge_method: rebase_merge
wiki_enabled: True
snippets_enabled: True
import_url: http://git.example.com/example/lab.git
state: present
delegate_to: localhost
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: “400: path is already in use” |
|
Success or failure message. Returned: always Sample: “Success” |
|
API object. Returned: always |
|
json parsed response from the server. Returned: always |
Authors
Werner Dijkerman (@dj-wasabi)
Guillaume Martinez (@Lunik)