gitlab_project – Creates/updates/deletes Gitlab Projects

From Get docs
Ansible/docs/2.7/modules/gitlab project module


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

-

An description for the project.

group

-

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

boolean

  • no

  • yes

Git repository which will be imported into gitlab.

Gitlab server needs read access to this git repository.

issues_enabled

boolean

  • no
  • yes

Whether you want to create issues or not.

Possible values are true and false.

login_password

-

Gitlab password for login_user

login_token

-

Gitlab token for logging in.

login_user

-

Gitlab user name.

merge_requests_enabled

boolean

  • no
  • yes

If merge requests can be made or not.

Possible values are true and false.

name

- / required

The name of the project

path

-

The path of the project you want to create, this will be server_url//path

If not supplied, name will be used.

public

boolean

  • no

  • yes

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

boolean

  • no
  • yes

If creating snippets should be available or not.

Possible values are true and false.

state

-

  • present

  • absent

create or delete project.

Possible values are present and absent.

validate_certs

boolean

  • no
  • 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

boolean

  • no
  • 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

Authors

  • 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.7/modules/gitlab_project_module.html