community.digitalocean.digital_ocean_certificate_info 模块 – 收集关于 DigitalOcean 证书的信息

注意

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

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

要安装它,请使用: ansible-galaxy collection install community.digitalocean。您需要其他要求才能使用此模块,有关详细信息,请参阅 要求

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

概要

  • 此模块可用于收集有关 DigitalOcean 提供的证书的信息。

  • 在 Ansible 2.9 之前,此模块称为 digital_ocean_certificate_facts。用法没有改变。

别名:digital_ocean_certificate_facts

要求

执行此模块的主机需要以下要求。

  • python >= 2.6

参数

参数

注释

baseurl

字符串

DigitalOcean API 基本 URL。

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

certificate_id

字符串

可用于标识和引用证书的证书 ID。

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 information about all certificates
  community.digitalocean.digital_ocean_certificate_info:
    oauth_token: "{{ oauth_token }}"

- name: Gather information about certificate with given id
  community.digitalocean.digital_ocean_certificate_info:
    oauth_token: "{{ oauth_token }}"
    certificate_id: "892071a0-bb95-49bc-8021-3afd67a210bf"

- name: Get not after information about certificate
  community.digitalocean.digital_ocean_certificate_info:
  register: resp_out
- set_fact:
    not_after_date: "{{ item.not_after }}"
  loop: "{{ resp_out.data | community.general.json_query(name) }}"
  vars:
    name: "[?name=='web-cert-01']"
- debug:
    var: not_after_date

返回值

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

描述

data

列表 / 元素=字典

DigitalOcean 证书信息

返回:成功

示例: [{"created_at": "2017-02-08T16:02:37Z", "id": "892071a0-bb95-49bc-8021-3afd67a210bf", "name": "web-cert-01", "not_after": "2017-02-22T00:23:00Z", "sha1_fingerprint": "dfcc9f57d86bf58e321c2c6c31c7a971be244ac7"}]

作者

  • Abhijeet Kasurde (@Akasurde)