community.general.gitlab_milestone (8.5.0) — module

Creates/updates/deletes GitLab Milestones belonging to project or group

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

Authors: Gabriele Pongelli (@gpongelli)

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

When a milestone does not exist, it will be created.

When a milestone does exist, its value will be updated when the values are different.

Milestones can be purged.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# same project's task can be executed for group
- name: Create one milestone
  community.general.gitlab_milestone:
    api_url: https://gitlab.com
    api_token: secret_access_token
    project: "group1/project1"
    milestones:
      - title: milestone_one
        start_date: "2024-01-04"
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create many group milestones
  community.general.gitlab_milestone:
    api_url: https://gitlab.com
    api_token: secret_access_token
    group: "group1"
    milestones:
      - title: milestone_one
        start_date: "2024-01-04"
        description: this is a milestone
        due_date: "2024-02-04"
      - title: milestone_two
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create many project milestones
  community.general.gitlab_milestone:
    api_url: https://gitlab.com
    api_token: secret_access_token
    project: "group1/project1"
    milestones:
      - title: milestone_one
        start_date: "2024-01-04"
        description: this is a milestone
        due_date: "2024-02-04"
      - title: milestone_two
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Set or update some milestones
  community.general.gitlab_milestone:
    api_url: https://gitlab.com
    api_token: secret_access_token
    project: "group1/project1"
    milestones:
      - title: milestone_one
        start_date: "2024-05-04"
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Add milestone in check mode
  community.general.gitlab_milestone:
    api_url: https://gitlab.com
    api_token: secret_access_token
    project: "group1/project1"
    milestones:
      - title: milestone_one
        start_date: "2024-05-04"
    check_mode: true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete milestone
  community.general.gitlab_milestone:
    api_url: https://gitlab.com
    api_token: secret_access_token
    project: "group1/project1"
    milestones:
      - title: milestone_one
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Purge all milestones
  community.general.gitlab_milestone:
    api_url: https://gitlab.com
    api_token: secret_access_token
    project: "group1/project1"
    purge: true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete many milestones
  community.general.gitlab_milestone:
    api_url: https://gitlab.com
    api_token: secret_access_token
    project: "group1/project1"
    state: absent
    milestones:
      - title: milestone-abc123
      - title: milestone-two

Inputs

    
group:
    description:
    - The path of the group. Either this or O(project) is required.
    required: false
    type: str

purge:
    default: false
    description:
    - When set to V(true), delete all milestone which are not mentioned in the task.
    required: false
    type: bool

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

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 and name of the project. Either this or O(group) is required.
    required: false
    type: str

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

milestones:
    default: []
    description:
    - A list of dictionaries that represents gitlab project's or group's milestones.
    elements: dict
    required: false
    suboptions:
      description:
        default: null
        description:
        - Milestone's description.
        type: str
      due_date:
        default: null
        description:
        - Milestone due date in YYYY-MM-DD format.
        required: false
        type: str
      start_date:
        default: null
        description:
        - Milestone start date in YYYY-MM-DD format.
        required: false
        type: str
      title:
        description:
        - The name of the milestone.
        required: true
        type: str
    type: list

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

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

Outputs

milestones:
  contains:
    added:
      description: A list of milestones which were created.
      returned: always
      sample:
      - abcd
      - milestone-one
      type: list
    removed:
      description: A list of milestones which were deleted.
      returned: always
      sample:
      - defg
      - new-milestone
      type: list
    untouched:
      description: A list of milestones which exist.
      returned: always
      sample:
      - defg
      - new-milestone
      type: list
    updated:
      description: A list pre-existing milestones whose values have been set.
      returned: always
      sample:
      - defg
      - new-milestone
      type: list
  description: Four lists of the milestones which were added, updated, removed or
    exist.
  returned: success
  type: dict
milestones_obj:
  description: API object.
  returned: success
  type: dict