community.digitalocean.digital_ocean_certificate 模块 – 在 DigitalOcean 中管理证书
注意
此模块是 community.digitalocean 集合 (版本 1.27.0) 的一部分。
如果您使用的是 ansible
包,则可能已安装此集合。它不包含在 ansible-core
中。要检查它是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用: ansible-galaxy collection install community.digitalocean
。
要在 playbook 中使用它,请指定: community.digitalocean.digital_ocean_certificate
。
概要
创建、检索和删除 DigitalOcean 证书。
参数
参数 |
注释 |
---|---|
DigitalOcean API 基本 URL。 默认值: |
|
证书颁发机构证书和您的域的 SSL 证书之间的完整 PEM 格式信任链。 |
|
PEM 格式的公共 SSL 证书。 |
|
证书的名称。 |
|
DigitalOcean OAuth 令牌。 可以使用多个其他环境变量来提供此值。 例如 - |
|
PEM 格式的 SSL 证书私钥内容。 |
|
证书是否存在。 选项
|
|
用于轮询 DigitalOcean API 的超时时间(秒)。 默认值: |
|
如果设置为 只有在使用自签名证书的个人控制站点上才应将其设置为 选项
|
备注
注意
可以使用两个环境变量 DO_API_KEY、DO_OAUTH_TOKEN 和 DO_API_TOKEN。它们都指的是 v2 令牌。
示例
- name: Create a certificate
community.digitalocean.digital_ocean_certificate:
name: production
state: present
private_key: "-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkM8OI7pRpgyj1I\n-----END PRIVATE KEY-----"
leaf_certificate: "-----BEGIN CERTIFICATE-----\nMIIFDmg2Iaw==\n-----END CERTIFICATE-----"
oauth_token: b7d03a6947b217efb6f3ec3bd365652
- name: Create a certificate using file lookup plugin
community.digitalocean.digital_ocean_certificate:
name: production
state: present
private_key: "{{ lookup('file', 'test.key') }}"
leaf_certificate: "{{ lookup('file', 'test.cert') }}"
oauth_token: "{{ oauth_token }}"
- name: Create a certificate with trust chain
community.digitalocean.digital_ocean_certificate:
name: production
state: present
private_key: "{{ lookup('file', 'test.key') }}"
leaf_certificate: "{{ lookup('file', 'test.cert') }}"
certificate_chain: "{{ lookup('file', 'chain.cert') }}"
oauth_token: "{{ oauth_token }}"
- name: Remove a certificate
community.digitalocean.digital_ocean_certificate:
name: production
state: absent
oauth_token: "{{ oauth_token }}"