community.general.gitlab_protected_branch (8.5.0) — module

Manage protection of existing branches

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

Authors: Werner Dijkerman (@dj-wasabi)

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

(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 character for like V(production/*) or just have V(main)
      or V(develop) as value.
    required: true
    type: str

state:
    choices:
    - present
    - absent
    default: present
    description:
    - Create or delete protected branch.
    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.
    required: true
    type: str

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

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

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