Note
This plugin is part of the community.general collection (version 3.8.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
.
To use it in a playbook, specify: community.general.gitlab_project
.
The below requirements are needed on the host that executes this module.
Parameter | Choices/Defaults | Comments |
---|---|---|
allow_merge_on_skipped_pipeline boolean added in 3.4.0 of community.general |
| Allow merge when skipped pipelines exist. |
api_password string | The password to use for authentication against the API | |
api_token string | GitLab token for logging in. | |
api_url string | The resolvable endpoint for the API | |
api_username string | The username to use for authentication against the API | |
ci_config_path string added in 3.7.0 of community.general | Custom path to the CI configuration file for this project. | |
description string | An description for the project. | |
group string | Id or the full path of the group of which this projects belongs to. | |
import_url string | Git repository which will be imported into gitlab. GitLab server needs read access to this git repository. | |
issues_enabled boolean |
| Whether you want to create issues or not. Possible values are true and false. |
lfs_enabled boolean added in 2.0.0 of community.general |
| Enable Git large file systems to manages large files such as audio, video, and graphics files. |
merge_method string added in 1.0.0 of community.general |
| What requirements are placed upon merges. Possible values are merge , rebase_merge merge commit with semi-linear history, ff fast-forward merges only. |
merge_requests_enabled boolean |
| If merge requests can be made or not. Possible values are true and false. |
name string / required | The name of the project. | |
only_allow_merge_if_all_discussions_are_resolved boolean added in 3.4.0 of community.general |
| All discussions on a merge request (MR) have to be resolved. |
only_allow_merge_if_pipeline_succeeds boolean added in 3.4.0 of community.general |
| Only allow merges if pipeline succeeded. |
packages_enabled boolean added in 3.4.0 of community.general |
| Enable GitLab package repository. |
path string | The path of the project you want to create, this will be server_url/<group>/path. If not supplied, name will be used. | |
remove_source_branch_after_merge boolean added in 3.4.0 of community.general |
| Remove the source branch after merge. |
shared_runners_enabled boolean added in 3.7.0 of community.general |
| Enable shared runners for this project. |
snippets_enabled boolean |
| If creating snippets should be available or not. |
squash_option string added in 3.4.0 of community.general |
| Squash commits when merging. |
state string |
| Create or delete project. Possible values are present and absent. |
username string added in 3.3.0 of community.general | Used to create a personal project under a user's name. | |
validate_certs boolean |
| Whether or not to validate SSL certs when supplying a https endpoint. |
visibility string |
| private Project access must be granted explicitly for each user.internal The project can be cloned by any logged in user.public The project can be cloned without any authentication.aliases: visibility_level |
wiki_enabled boolean |
| If an wiki for this project should be available or not. |
- 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
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 |
msg string | always | Success or failure message. Sample: Success |
project dictionary | always | API object. |
result dictionary | always | json parsed response from the server. |
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/general/gitlab_project_module.html