community.general.gitlab_issue (8.5.0) — module

Create, update, or delete GitLab issues

| "added in version" 8.1.0 of community.general"

Authors: zvaraondrej (@zvaraondrej)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

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 O(state=absent), the issue will be deleted.

When multiple issues are detected, the task fails.

Existing issues are matched based on O(title) and O(state_filter) filters.


Requirements

Usage examples

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

Inputs

    
state:
    choices:
    - present
    - absent
    default: present
    description:
    - Create or delete issue.
    type: str

title:
    description:
    - A title for the issue. The title is used as a unique identifier to ensure idempotency.
    required: true
    type: str

labels:
    description:
    - A list of label names.
    - Set to an empty array to remove all labels.
    elements: str
    type: list

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

ca_path:
    description:
    - The CA certificates bundle to use to verify GitLab server certificate.
    type: str
    version_added: 8.1.0
    version_added_collection: community.general

project:
    description:
    - The path or name of the project.
    required: true
    type: str

api_token:
    description:
    - GitLab access token with API permissions.
    type: str

issue_type:
    choices:
    - issue
    - incident
    - test_case
    default: issue
    description:
    - Type of the issue.
    type: str

description:
    description:
    - A description of the issue.
    - Gets overridden by a content of file specified at O(description_path), if found.
    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

assignee_ids:
    description:
    - A list of assignee usernames omitting V(@) character.
    - Set to an empty array to unassign all assignees.
    elements: str
    type: list

state_filter:
    choices:
    - opened
    - closed
    default: opened
    description:
    - Filter specifying state of issues while searching.
    type: str

api_job_token:
    description:
    - GitLab CI job token for logging in.
    type: str
    version_added: 4.2.0
    version_added_collection: community.general

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

api_oauth_token:
    description:
    - GitLab OAuth token for logging in.
    type: str
    version_added: 4.2.0
    version_added_collection: community.general

description_path:
    description:
    - A path of file containing issue's description.
    - Accepts MarkDown formatted files.
    type: path

milestone_search:
    description:
    - The name of the milestone.
    - Set to empty string to unassign milestone.
    type: str

milestone_group_id:
    description:
    - The path or numeric ID of the group hosting desired milestone.
    type: str

Outputs

issue:
  description: API object.
  returned: success
  type: dict
msg:
  description: Success or failure message.
  returned: always
  sample: Success
  type: str