community.general.gitlab_project_badge module – Manage project badges on GitLab Server
Note
This module is part of the community.general collection (version 8.6.7).
You might already have this collection installed if you are using the ansible
package.
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_project_badge
.
New in community.general 6.1.0
Synopsis
This module allows to add and remove badges to/from a project.
Requirements
The below requirements are needed on the host that executes this module.
owner
ormaintainer
rights to project on the GitLab serverrequests (Python library https://pypi.org/project/requests/)
Parameters
Parameter |
Comments |
---|---|
GitLab CI job token for logging in. |
|
GitLab OAuth token for logging in. |
|
The password to use for authentication against the API. |
|
GitLab access token with API permissions. |
|
The resolvable endpoint for the API. |
|
The username to use for authentication against the API. |
|
The CA certificates bundle to use to verify GitLab server certificate. |
|
The image URL of the badge. A badge is identified by this URL. |
|
The URL associated with the badge. |
|
The name (or full path) of the GitLab project the badge is added to/removed from. |
|
State of the badge in the project. On On Choices:
|
|
Whether or not to validate SSL certs when supplying a HTTPS endpoint. Choices:
|
Attributes
Attribute |
Support |
Description |
---|---|---|
Support: full |
Can run in |
|
Support: none |
Will return details on what has changed (or possibly needs changing in |
Examples
- name: Add a badge to a GitLab Project
community.general.gitlab_project_badge:
api_url: 'https://example.gitlab.com'
api_token: 'Your-Private-Token'
project: projectname
state: present
link_url: 'https://example.gitlab.com/%{project_path}'
image_url: 'https://example.gitlab.com/%{project_path}/badges/%{default_branch}/pipeline.svg'
- name: Remove a badge from a GitLab Project
community.general.gitlab_project_badge:
api_url: 'https://example.gitlab.com'
api_token: 'Your-Private-Token'
project: projectname
state: absent
link_url: 'https://example.gitlab.com/%{project_path}'
image_url: 'https://example.gitlab.com/%{project_path}/badges/%{default_branch}/pipeline.svg'
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
The badge information. Returned: when Sample: |