community.digitalocean.digital_ocean_project_info 模块 – 收集关于 DigitalOcean 项目的信息

注意

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

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

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

要在剧本中使用它,请指定: community.digitalocean.digital_ocean_project_info

community.digitalocean 1.6.0 中的新增功能

概要

  • 此模块可用于收集关于项目的信息。

参数

参数

注释

baseurl

字符串

DigitalOcean API 基本 URL。

默认值: "https://api.digitalocean.com/v2"

id

字符串

可用于识别和引用项目的 Project ID。

name

字符串

可用于识别和引用项目的项目名称。

oauth_token

别名:api_token

字符串

DigitalOcean OAuth 令牌。

还有其他几个环境变量可用于提供此值。

例如: - DO_API_TOKENDO_API_KEYDO_OAUTH_TOKENOAUTH_TOKEN

timeout

整数

用于轮询 DigitalOcean API 的超时时间(秒)。

默认值: 30

validate_certs

布尔值

如果设置为 no,则不会验证 SSL 证书。

只有在使用自签名证书的个人控制站点上才应将其设置为 no

选项

  • false

  • true ← (默认值)

示例

# Get specific project by id
- community.digitalocean.digital_ocean_project_info:
    id: cb1ef55e-3cd8-4c7c-aa5d-07c32bf41627

# Get specific project by name
- community.digitalocean.digital_ocean_project_info:
    name: my-project-name

# Get all projects
- community.digitalocean.digital_ocean_project_info:
  register: projects

返回值

常见返回值已在 此处 记录,以下是此模块特有的字段

描述

data

列表 / 元素=字典

DigitalOcean 项目信息

返回:成功

示例: [{"created_at": "2021-03-11T00:00:00Z", "description": "My project description", "environment": "Development", "id": "12345678-abcd-efgh-5678-10111213", "is_default": false, "name": "my-test-project", "owner_id": 12345678, "owner_uuid": "12345678-1234-4321-abcd-20212223", "purpose": "", "updated_at": "2021-03-11T00:00:00Z"}]

作者

  • Tyler Auerbeck (@tylerauerbeck)