community.digitalocean.digital_ocean_sshkey_info 模块 – 收集关于 DigitalOcean SSH 密钥的信息
注意
此模块是 community.digitalocean 集合(版本 1.27.0)的一部分。
如果您正在使用 ansible
包,您可能已经安装了此集合。它不包含在 ansible-core
中。要检查它是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用:ansible-galaxy collection install community.digitalocean
。您需要进一步的要求才能使用此模块,请参阅 要求 了解详细信息。
要在 playbook 中使用它,请指定:community.digitalocean.digital_ocean_sshkey_info
。
概要
此模块可用于收集关于 DigitalOcean SSH 密钥的信息。
此模块取代了
digital_ocean_sshkey_facts
模块。
别名:digital_ocean_sshkey_facts
要求
执行此模块的主机需要满足以下要求。
python >= 2.6
参数
参数 |
注释 |
---|---|
DigitalOcean API 基本 URL。 默认值: |
|
DigitalOcean OAuth 令牌。 还有几个其他环境变量可用于提供此值。 例如,- |
|
用于轮询 DigitalOcean API 的超时时间(以秒为单位)。 默认值: |
|
如果设置为 这应该只在个人控制的使用自签名证书的站点上设置为 选择
|
注释
注意
使用 DigitalOcean API 的第 2 版。
示例
- name: Gather information about DigitalOcean SSH keys
community.digitalocean.digital_ocean_sshkey_info:
oauth_token: "{{ my_do_key }}"
register: ssh_keys
- name: Set facts based on the gathered information
set_fact:
pubkey: "{{ item.public_key }}"
loop: "{{ ssh_keys.data | community.general.json_query(ssh_pubkey) }}"
vars:
ssh_pubkey: "[?name=='ansible_ctrl']"
- name: Print SSH public key
debug:
msg: "{{ pubkey }}"
返回值
常见的返回值记录在 这里,以下是此模块特有的字段
键 |
描述 |
---|---|
DigitalOcean 上 SSH 密钥的列表 返回值: 成功且没有资源约束 示例: |