community.general.gitlab_issue module – Create, update, or delete GitLab issues

Note

This module is part of the community.general collection (version 9.4.0).

It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install community.general. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: community.general.gitlab_issue.

New in community.general 8.1.0

Synopsis

  • Creates an issue if it does not exist.

  • When an issue does exist, it will be updated if the provided parameters are different.

  • When an issue does exist and state=absent, the issue will be deleted.

  • When multiple issues are detected, the task fails.

  • Existing issues are matched based on title and state_filter filters.

Requirements

The below requirements are needed on the host that executes this module.

Parameters

Parameter

Comments

api_job_token

string

added in community.general 4.2.0

GitLab CI job token for logging in.

api_oauth_token

string

added in community.general 4.2.0

GitLab OAuth token for logging in.

api_password

string

The password to use for authentication against the API.

api_token

string

GitLab access token with API permissions.

api_url

string

The resolvable endpoint for the API.

api_username

string

The username to use for authentication against the API.

assignee_ids

list / elements=string

A list of assignee usernames omitting @ character.

Set to an empty array to unassign all assignees.

ca_path

string

added in community.general 8.1.0

The CA certificates bundle to use to verify GitLab server certificate.

description

string

A description of the issue.

Gets overridden by a content of file specified at description_path, if found.

description_path

path

A path of file containing issue’s description.

Accepts MarkDown formatted files.

issue_type

string

Type of the issue.

Choices:

  • "issue" ← (default)

  • "incident"

  • "test_case"

labels

list / elements=string

A list of label names.

Set to an empty array to remove all labels.

milestone_group_id

string

The path or numeric ID of the group hosting desired milestone.

string

The name of the milestone.

Set to empty string to unassign milestone.

project

string / required

The path or name of the project.

state

string

Create or delete issue.

Choices:

  • "present" ← (default)

  • "absent"

state_filter

string

Filter specifying state of issues while searching.

Choices:

  • "opened" ← (default)

  • "closed"

title

string / required

A title for the issue. The title is used as a unique identifier to ensure idempotency.

validate_certs

boolean

Whether or not to validate SSL certs when supplying a HTTPS endpoint.

Choices:

  • false

  • true ← (default)

Attributes

Attribute

Support

Description

check_mode

Support: full

Can run in check_mode and return changed status prediction without modifying target.

diff_mode

Support: none

Will return details on what has changed (or possibly needs changing in check_mode), when in diff mode.

Examples

- name: Create Issue
  community.general.gitlab_issue:
    api_url: https://gitlab.com
    api_token: secret_access_token
    project: "group1/project1"
    title: "Ansible demo Issue"
    description: "Demo Issue description"
    labels:
        - Ansible
        - Demo
    assignee_ids:
        - testassignee
    state_filter: "opened"
    state: present

- name: Delete Issue
  community.general.gitlab_issue:
    api_url: https://gitlab.com
    api_token: secret_access_token
    project: "group1/project1"
    title: "Ansible demo Issue"
    state_filter: "opened"
    state: absent

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

issue

dictionary

API object.

Returned: success

msg

string

Success or failure message.

Returned: always

Sample: "Success"

Authors

  • zvaraondrej (@zvaraondrej)