community.general.bitbucket_access_key 模块 – 管理 Bitbucket 仓库访问密钥

注意

此模块是 community.general 集合(版本 10.1.0)的一部分。

如果您使用的是 ansible 包,您可能已经安装了此集合。它不包含在 ansible-core 中。要检查是否已安装,请运行 ansible-galaxy collection list

要安装它,请使用: ansible-galaxy collection install community.general

要在 playbook 中使用它,请指定: community.general.bitbucket_access_key

概要

  • 管理 Bitbucket 仓库访问密钥(也称为部署密钥)。

参数

参数

注释

client_id

字符串

OAuth 消费者密钥。

如果未设置,将使用环境变量 BITBUCKET_CLIENT_ID

client_secret

字符串

OAuth 消费者密钥。

如果未设置,将使用环境变量 BITBUCKET_CLIENT_SECRET

key

字符串

SSH 公钥。

label

字符串 / 必需

密钥标签。

password

字符串

在 community.general 4.0.0 中添加

应用程序密码。

如果未设置,将使用环境变量 BITBUCKET_PASSWORD

repository

字符串 / 必需

仓库名称。

state

字符串 / 必需

指示访问密钥的期望状态。

选项

  • "absent"

  • "present"

user

别名:username

字符串

在 community.general 4.0.0 中添加

用户名。

如果未设置,将使用环境变量 BITBUCKET_USERNAME

username 自 community.general 6.0.0 起是 user 的别名。在此之前,它是 workspace 的别名。

workspace

字符串 / 必需

仓库所有者。

注意:username 曾经是此选项的别名。自 community.general 6.0.0 起,它是 user 的别名。

属性

属性

支持

描述

check_mode

支持: 完全

可以在 check_mode 中运行并返回更改状态预测,而无需修改目标。

diff_mode

支持:

当处于 diff 模式时,将返回已更改(或可能需要在 check_mode 中更改)的详细信息。

注意

注意

  • Bitbucket OAuth 消费者或应用程序密码应具有读取和管理帐户仓库的权限。

  • 支持检查模式。

  • Bitbucket OAuth 消费者密钥和机密可以从 Bitbucket 个人资料 -> 设置 -> 访问管理 -> OAuth 中获取。

  • Bitbucket 应用程序密码可以从 Bitbucket 个人资料 -> 个人设置 -> 应用程序密码中创建。

  • 如果同时传递 OAuth 和基本身份验证凭据,则 OAuth 凭据优先。

示例

- name: Create access key
  community.general.bitbucket_access_key:
    repository: 'bitbucket-repo'
    workspace: bitbucket_workspace
    key: '{{lookup("file", "bitbucket.pub") }}'
    label: 'Bitbucket'
    state: present

- name: Delete access key
  community.general.bitbucket_access_key:
    repository: bitbucket-repo
    workspace: bitbucket_workspace
    label: Bitbucket
    state: absent

作者

  • Evgeniy Krysanov (@catcombo)