community.general.gitlab_milestone 模块 – 创建/更新/删除属于项目或组的 GitLab 里程碑
注意
此模块是 community.general 集合 (版本 10.1.0) 的一部分。
如果您正在使用 ansible
包,您可能已经安装了这个集合。它不包含在 ansible-core
中。要检查是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用:ansible-galaxy collection install community.general
。您需要进一步的要求才能使用此模块,请参阅 要求 获取详细信息。
要在 playbook 中使用它,请指定:community.general.gitlab_milestone
。
community.general 8.3.0 中的新增功能
概要
当里程碑不存在时,将创建它。
当里程碑存在时,如果值不同,则会更新其值。
里程碑可以被清除。
要求
以下要求在执行此模块的主机上是必需的。
python-gitlab python 模块
requests(Python 库 https://pypi.ac.cn/project/requests/)
参数
参数 |
注释 |
---|---|
用于登录的 GitLab CI 作业令牌。 |
|
用于登录的 GitLab OAuth 令牌。 |
|
用于针对 API 进行身份验证的密码。 |
|
具有 API 权限的 GitLab 访问令牌。 |
|
API 的可解析端点。 |
|
用于针对 API 进行身份验证的用户名。 |
|
用于验证 GitLab 服务器证书的 CA 证书捆绑包。 |
|
组的路径。需要此项或 |
|
表示 gitlab 项目或组里程碑的字典列表。 默认值: |
|
里程碑的描述。 |
|
里程碑截止日期,格式为 YYYY-MM-DD。 |
|
里程碑开始日期,格式为 YYYY-MM-DD。 |
|
里程碑的名称。 |
|
项目的路径和名称。需要此项或 |
|
设置为 选项
|
|
创建或删除里程碑。 选项
|
|
当提供 HTTPS 端点时,是否验证 SSL 证书。 选项
|
属性
属性 |
支持 |
描述 |
---|---|---|
支持: 完整 |
可以在 |
|
支持: 无 |
在 diff 模式下运行时,将返回有关已更改内容(或可能需要在 |
示例
# same project's task can be executed for group
- name: Create one milestone
community.general.gitlab_milestone:
api_url: https://gitlab.com
api_token: secret_access_token
project: "group1/project1"
milestones:
- title: milestone_one
start_date: "2024-01-04"
state: present
- name: Create many group milestones
community.general.gitlab_milestone:
api_url: https://gitlab.com
api_token: secret_access_token
group: "group1"
milestones:
- title: milestone_one
start_date: "2024-01-04"
description: this is a milestone
due_date: "2024-02-04"
- title: milestone_two
state: present
- name: Create many project milestones
community.general.gitlab_milestone:
api_url: https://gitlab.com
api_token: secret_access_token
project: "group1/project1"
milestones:
- title: milestone_one
start_date: "2024-01-04"
description: this is a milestone
due_date: "2024-02-04"
- title: milestone_two
state: present
- name: Set or update some milestones
community.general.gitlab_milestone:
api_url: https://gitlab.com
api_token: secret_access_token
project: "group1/project1"
milestones:
- title: milestone_one
start_date: "2024-05-04"
state: present
- name: Add milestone in check mode
community.general.gitlab_milestone:
api_url: https://gitlab.com
api_token: secret_access_token
project: "group1/project1"
milestones:
- title: milestone_one
start_date: "2024-05-04"
check_mode: true
- name: Delete milestone
community.general.gitlab_milestone:
api_url: https://gitlab.com
api_token: secret_access_token
project: "group1/project1"
milestones:
- title: milestone_one
state: absent
- name: Purge all milestones
community.general.gitlab_milestone:
api_url: https://gitlab.com
api_token: secret_access_token
project: "group1/project1"
purge: true
- name: Delete many milestones
community.general.gitlab_milestone:
api_url: https://gitlab.com
api_token: secret_access_token
project: "group1/project1"
state: absent
milestones:
- title: milestone-abc123
- title: milestone-two
返回值
常见的返回值已在此处记录 此处,以下是此模块特有的字段
键 |
描述 |
---|---|
包含已添加、更新、删除或存在的里程碑的四个列表。 返回: 成功 |
|
已创建的里程碑的列表。 返回: 始终 示例: |
|
已删除的里程碑的列表。 返回: 始终 示例: |
|
存在的里程碑的列表。 返回: 始终 示例: |
|
其值已设置的预先存在的里程碑的列表。 返回: 始终 示例: |
|
API 对象。 返回: 成功 |