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

Creates/updates/deletes GitLab Projects

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

Authors: Werner Dijkerman (@dj-wasabi), Guillaume Martinez (@Lunik)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.27

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:
    api_url: https://gitlab.example.com/
    api_token: "{{ access_token }}"
    validate_certs: False
    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:
    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
    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
    type: str

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

group:
    description:
    - Id or The full path of the group of which this projects belongs to.
    type: str

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

api_url:
    description:
    - The resolvable endpoint for the API
    type: str

api_token:
    aliases:
    - login_token
    description:
    - GitLab token for logging in.
    type: str

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

login_user:
    description:
    - GitLab user name.
    type: str

server_url:
    description:
    - The URL of the GitLab server, with protocol (i.e. http or https).
    type: str

visibility:
    aliases:
    - visibility_level
    choices:
    - private
    - internal
    - public
    default: private
    description:
    - 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.
    type: str

description:
    description:
    - An description for the project.
    type: str

api_password:
    description:
    - The password to use for authentication against the API
    type: str

api_username:
    description:
    - The username to use for authentication against the API
    type: str

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

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

login_password:
    description:
    - GitLab password for login_user
    type: str

validate_certs:
    default: true
    description:
    - Whether or not to validate SSL certs when supplying a https endpoint.
    type: bool

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

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

Outputs

error:
  description: the error message returned by the GitLab API
  returned: failed
  sample: '400: path is already in use'
  type: str
msg:
  description: Success or failure message
  returned: always
  sample: Success
  type: str
project:
  description: API object
  returned: always
  type: dict
result:
  description: json parsed response from the server
  returned: always
  type: dict