community.digitalocean.digital_ocean_database_info 模块 – 收集 DigitalOcean 数据库信息

注意

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

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

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

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

community.digitalocean 1.3.0 中的新增功能

概要

  • 收集 DigitalOcean 数据库信息。

参数

参数

注释

baseurl

字符串

DigitalOcean API 基本 URL。

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

id

别名:database_id

整数

可用于标识和引用数据库集群的唯一 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 ← (默认)

示例

- name: Gather all DigitalOcean databases
  community.digitalocean.digital_ocean_database_info:
    oauth_token: "{{ lookup('ansible.builtin.env', 'DO_API_KEY') }}"
  register: my_databases

返回值

公共返回值已在 此处 记录,以下是此模块独有的字段

描述

data

列表 / 元素=字符串

DigitalOcean 数据库列表

返回:成功

示例: [{"connection": {"database": "", "host": "testdatabase1-do-user-3097135-0.b.db.ondigitalocean.com", "password": "REDACTED", "port": 25061, "protocol": "rediss", "ssl": true, "uri": "rediss://default:[email protected]:25061", "user": "default"}, "created_at": "2021-04-21T15:41:14Z", "db_names": null, "engine": "redis", "id": "37de10e4-808b-4f4b-b25f-7b5b3fd194ac", "maintenance_window": {"day": "monday", "hour": "11:33:47", "pending": false}, "name": "testdatabase1", "num_nodes": 1, "private_connection": {"database": "", "host": "private-testdatabase1-do-user-3097135-0.b.db.ondigitalocean.com", "password": "REDACTED", "port": 25061, "protocol": "rediss", "ssl": true, "uri": "rediss://default:REDACTED@private-testdatabase1-do-user-3097135-0.b.db.ondigitalocean.com:25061", "user": "default"}, "private_network_uuid": "0db3519b-9efc-414a-8868-8f2e6934688c", "region": "nyc1", "size": "db-s-1vcpu-1gb", "status": "online", "tags": null, "users": null, "version": "6"}, "..."]

作者

  • Mark Mercado (@mamercad)