gitlab_project - Creates/updates/deletes Gitlab Projects

New in version 2.1.

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.

  • pyapi-gitlab python module

Parameters

Parameter Choices/Defaults Comments
description Default:
None
An description for the project.
group Default:
None
The name of the group of which this projects belongs to.
When not provided, project will belong to user which is configured in 'login_user' or 'login_token'
When provided with username, project will be created for this user. 'login_user' or 'login_token' needs admin rights.
import_url Default:
no
Git repository which will be imported into gitlab.
Gitlab server needs read access to this git repository.
issues_enabled Default:
yes
Whether you want to create issues or not.
Possible values are true and false.
login_password Default:
None
Gitlab password for login_user
login_token Default:
None
Gitlab token for logging in.
login_user Default:
None
Gitlab user name.
merge_requests_enabled Default:
yes
If merge requests can be made or not.
Possible values are true and false.
name
required
The name of the project
path Default:
None
The path of the project you want to create, this will be server_url/<group>/path
If not supplied, name will be used.
public Default:
no
If the project is public available or not.
Setting this to true is same as setting visibility_level to 20.
Possible values are true and false.
server_url
required
Url of Gitlab server, with protocol (http or https).
snippets_enabled Default:
yes
If creating snippets should be available or not.
Possible values are true and false.
state
    Choices:
  • present
  • absent
create or delete project.
Possible values are present and absent.
validate_certs Default:
yes
When using https if SSL certificate needs to be verified.

aliases: verify_ssl
visibility_level Default:
0
Private. visibility_level is 0. Project access must be granted explicitly for each user.
Internal. visibility_level is 10. The project can be cloned by any logged in user.
Public. visibility_level is 20. The project can be cloned without any authentication.
Possible values are 0, 10 and 20.
wiki_enabled Default:
yes
If an wiki for this project should be available or not.
Possible values are true and false.

Examples

- name: Delete Gitlab Project
  gitlab_project:
    server_url: http://gitlab.example.com
    validate_certs: False
    login_token: WnUzDsxjy8230-Dy_k
    name: my_first_project
    state: absent
  delegate_to: localhost

- name: Create Gitlab Project in group Ansible
  gitlab_project:
    server_url: https://gitlab.example.com
    validate_certs: True
    login_user: dj-wasabi
    login_password: MySecretPassword
    name: my_first_project
    group: ansible
    issues_enabled: False
    wiki_enabled: True
    snippets_enabled: True
    import_url: http://git.example.com/example/lab.git
    state: present
  delegate_to: localhost

Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Author

  • Werner Dijkerman (@dj-wasabi)

Hint

If you notice any issues in this documentation you can edit this document to improve it.

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.5/modules/gitlab_project_module.html