community.general.gitlab_protected_branch module – Manage protection of existing branches
Note
This module is part of the community.general collection (version 5.8.3).
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_protected_branch
.
New in community.general 3.4.0
Synopsis
(un)Marking existing branches for protection.
Requirements
The below requirements are needed on the host that executes this module.
python >= 2.7
python-gitlab >= 2.3.0
requests (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 |
|
Access levels allowed to merge. Choices:
|
|
The name of the branch that needs to be protected. Can make use a wildcard character for like |
|
The path and name of the project. |
|
Access levels allowed to push. Choices:
|
|
Create or delete protected branch. Choices:
|
|
Whether or not to validate SSL certs when supplying a https endpoint. Choices:
|
Examples
- name: Create protected branch on main
community.general.gitlab_protected_branch:
api_url: https://gitlab.com
api_token: secret_access_token
project: "dj-wasabi/collection.general"
name: main
merge_access_levels: maintainer
push_access_level: nobody
Collection links
Issue Tracker Repository (Sources) Submit a bug report Request a feature Communication