community / community.general / 8.5.0 / module / gitlab_project_access_token Manages GitLab project access tokens | "added in version" 8.4.0 of community.general" Authors: Zoran Krleza (@pixslx)community.general.gitlab_project_access_token (8.5.0) — module
Install with ansible-galaxy collection install community.general:==8.5.0
collections: - name: community.general version: 8.5.0
Creates and revokes project access tokens.
- name: "Creating a project access token" community.general.gitlab_project_access_token: api_url: https://gitlab.example.com/ api_token: "somegitlabapitoken" project: "my_group/my_project" name: "project_token" expires_at: "2024-12-31" access_level: developer scopes: - api - read_api - read_repository - write_repository state: present
- name: "Revoking a project access token" community.general.gitlab_project_access_token: api_url: https://gitlab.example.com/ api_token: "somegitlabapitoken" project: "my_group/my_project" name: "project_token" expires_at: "2024-12-31" scopes: - api - read_api - read_repository - write_repository state: absent
- name: "Change (recreate) existing token if its actual state is different than desired state" community.general.gitlab_project_access_token: api_url: https://gitlab.example.com/ api_token: "somegitlabapitoken" project: "my_group/my_project" name: "project_token" expires_at: "2024-12-31" scopes: - api - read_api - read_repository - write_repository recreate: state_change state: present
name: description: - Access token's name. required: true type: str state: choices: - present - absent default: present description: - When V(present) the access token will be added to the project if it does not exist. - When V(absent) it will be removed from the project if it exists. type: str scopes: aliases: - scope choices: - api - read_api - read_registry - write_registry - read_repository - write_repository - create_runner - ai_features - k8s_proxy description: - Scope of the access token. elements: str required: true type: list 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: - ID or full path of project in the form of group/name. required: true type: str recreate: choices: - never - always - state_change default: never description: - Whether the access token will be recreated if it already exists. - When V(never) the token will never be recreated. - When V(always) the token will always be recreated. - When V(state_change) the token will be recreated if there is a difference between desired state and actual state. type: str api_token: description: - GitLab access token with API permissions. type: str expires_at: description: - Expiration date of the access token in C(YYYY-MM-DD) format. - Make sure to quote this value in YAML to ensure it is kept as a string and not interpreted as a YAML date. required: true type: str access_level: choices: - guest - reporter - developer - maintainer - owner default: maintainer description: - Access level of the access token. 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
access_token: description: - API object. - Only contains the value of the token if the token was created or recreated. returned: success and O(state=present) type: dict