community.general.gitlab_protected_branch (3.8.10) — module

(un)Marking existing branches for protection

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

Authors: Werner Dijkerman (@dj-wasabi)

Install collection

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


Add to requirements.yml

  collections:
    - name: community.general
      version: 3.8.10

Description

(un)Marking existing branches for protection.


Requirements

Usage examples

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

Inputs

    
name:
    description:
    - The name of the branch that needs to be protected.
    - Can make use a wildcard charachter for like C(production/*) or just have C(main)
      or C(develop) as value.
    required: true
    type: str

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

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

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

api_token:
    description:
    - GitLab access token with API permissions.
    required: true
    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

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

push_access_level:
    choices:
    - maintainer
    - developer
    - nobody
    default: maintainer
    description:
    - Access levels allowed to push.
    type: str

merge_access_levels:
    choices:
    - maintainer
    - developer
    - nobody
    default: maintainer
    description:
    - Access levels allowed to merge.
    type: str