W3cubDocs

/Ansible

gitlab_project - Creates/updates/deletes Gitlab Projects

New in version 2.1.

Synopsis

  • When the project does not exists 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 (on host that executes module)

  • pyapi-gitlab python module

Options

parameter required default choices comments
description
no
An description for the project.
group
no
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
no
Git repository which will me imported into gitlab.
Gitlab server needs read access to this git repository.
issues_enabled
no True
Whether you want to create issues or not.
Possible values are true and false.
login_password
no
Gitlab password for login_user
login_token
no
Gitlab token for logging in.
login_user
no
Gitlab user name.
merge_requests_enabled
no True
If merge requests can be made or not.
Possible values are true and false.
name
yes
The name of the project
path
no
The path of the project you want to create, this will be server_url/<group>/path
If not supplied, name will be used.
public
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
yes
Url of Gitlab server, with protocol (http or https).
snippets_enabled
no True
If creating snippets should be available or not.
Possible values are true and false.
state
no present
  • present
  • absent
create or delete project.
Possible values are present and absent.
validate_certs
no True
When using https if SSL certificate needs to be verified.
aliases: verify_ssl
visibility_level
no
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
no True
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.

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.

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