ansible.builtin.gitlab_project (v2.5.12) — module

Creates/updates/deletes Gitlab Projects

| "added in version" 2.1 of ansible.builtin"

Authors: Werner Dijkerman (@dj-wasabi)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.5.12

Description

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

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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

Inputs

    
name:
    description:
    - The name of the project
    required: true

path:
    default: null
    description:
    - The path of the project you want to create, this will be server_url/<group>/path
    - If not supplied, name will be used.
    required: false

group:
    default: null
    description:
    - 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.
    required: false

state:
    choices:
    - present
    - absent
    default: present
    description:
    - create or delete project.
    - Possible values are present and absent.
    required: false

public:
    default: false
    description:
    - 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.
    required: false

import_url:
    default: false
    description:
    - Git repository which will be imported into gitlab.
    - Gitlab server needs read access to this git repository.
    required: false

login_user:
    default: null
    description:
    - Gitlab user name.
    required: false

server_url:
    description:
    - Url of Gitlab server, with protocol (http or https).
    required: true

description:
    default: null
    description:
    - An description for the project.
    required: false

login_token:
    default: null
    description:
    - Gitlab token for logging in.
    required: false

wiki_enabled:
    default: true
    description:
    - If an wiki for this project should be available or not.
    - Possible values are true and false.
    required: false

issues_enabled:
    default: true
    description:
    - Whether you want to create issues or not.
    - Possible values are true and false.
    required: false

login_password:
    default: null
    description:
    - Gitlab password for login_user
    required: false

validate_certs:
    aliases:
    - verify_ssl
    default: true
    description:
    - When using https if SSL certificate needs to be verified.
    required: false

snippets_enabled:
    default: true
    description:
    - If creating snippets should be available or not.
    - Possible values are true and false.
    required: false

visibility_level:
    default: 0
    description:
    - 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.
    required: false

merge_requests_enabled:
    default: true
    description:
    - If merge requests can be made or not.
    - Possible values are true and false.
    required: false