community.general.gitlab_group_access_token 模块 – 管理 GitLab 组访问令牌
注意
此模块是 community.general 集合 (版本 10.1.0) 的一部分。
如果您使用的是 ansible 包,则可能已安装此集合。它不包含在 ansible-core 中。要检查它是否已安装,请运行 ansible-galaxy collection list。
要安装它,请使用:ansible-galaxy collection install community.general。您需要满足其他要求才能使用此模块,有关详细信息,请参阅 要求。
要在 playbook 中使用它,请指定:community.general.gitlab_group_access_token。
community.general 8.4.0 中的新增功能
概要
- 创建和撤销组访问令牌。 
要求
在执行此模块的主机上需要以下要求。
- python-gitlab >= 3.1.0 
- requests (Python 库 https://pypi.ac.cn/project/requests/) 
参数
| 参数 | 注释 | 
|---|---|
| 访问令牌的访问级别。 选项 
 | |
| 用于登录的 GitLab CI 作业令牌。 | |
| 用于登录的 GitLab OAuth 令牌。 | |
| 用于对 API 进行身份验证的密码。 | |
| 具有 API 权限的 GitLab 访问令牌。 | |
| API 的可解析端点。 | |
| 用于对 API 进行身份验证的用户名。 | |
| 用于验证 GitLab 服务器证书的 CA 证书包。 | |
| 访问令牌的过期日期,格式为  确保在 YAML 中用引号引起来此值,以确保将其保留为字符串,而不是解释为 YAML 日期。 | |
| 组的 ID 或完整路径,格式为 group/subgroup。 | |
| 访问令牌的名称。 | |
| 如果访问令牌已存在,是否会重新创建它。 当  当  当  选项 
 | |
| 访问令牌的范围。 选项 
 | |
| 当  当  选项 
 | |
| 是否在提供 HTTPS 端点时验证 SSL 证书。 选项 
 | 
属性
| 属性 | 支持 | 描述 | 
|---|---|---|
| 支持:完全支持 | 可以在  | |
| 支持:不支持 | 在差异模式下,将返回关于已更改内容(或可能需要在 | 
备注
示例
- name: "Creating a group access token"
  community.general.gitlab_group_access_token:
    api_url: https://gitlab.example.com/
    api_token: "somegitlabapitoken"
    group: "my_group/my_subgroup"
    name: "group_token"
    expires_at: "2024-12-31"
    access_level: developer
    scopes:
      - api
      - read_api
      - read_repository
      - write_repository
    state: present
- name: "Revoking a group access token"
  community.general.gitlab_group_access_token:
    api_url: https://gitlab.example.com/
    api_token: "somegitlabapitoken"
    group: "my_group/my_group"
    name: "group_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_group_access_token:
    api_url: https://gitlab.example.com/
    api_token: "somegitlabapitoken"
    group: "my_group/my_group"
    name: "group_token"
    expires_at: "2024-12-31"
    scopes:
      - api
      - read_api
      - read_repository
      - write_repository
    recreate: state_change
    state: present
返回值
常见的返回值已在此处记录,以下是此模块特有的字段
| 键 | 描述 | 
|---|---|
