community.hrobot.ssh_key 模块 – 添加、删除或更新 SSH 密钥
注意
此模块是 community.hrobot 集合 (版本 2.0.2) 的一部分。
如果您使用的是 ansible 包,则可能已安装此集合。它不包含在 ansible-core 中。要检查它是否已安装,请运行 ansible-galaxy collection list。
要安装它,请使用:ansible-galaxy collection install community.hrobot。
要在剧本中使用它,请指定:community.hrobot.ssh_key。
community.hrobot 1.2.0 中的新增功能
概要
- 添加、删除或更新存储在 Hetzner 的 Robot 中的 SSH 密钥。 
参数
| 参数 | 注释 | 
|---|---|
| 要删除的公共 SSH 密钥的 MD5 指纹。 如果  | |
| Robot 网络服务用户的密码。 | |
| Robot 网络服务用户的用户名。 | |
| 公共密钥的名称。 如果  | |
| 采用 OpenSSH 格式的公共密钥数据。 示例: 如果  如果  | |
| 确保公共 SSH 密钥存在还是不存在。 
 
 选项 
 | 
属性
| 属性 | 支持 | 描述 | 
|---|---|---|
| 动作组: community.hrobot.robot community.hrobot 1.6.0 中新增 | 在  | |
| 支持:完全支持 | 可以在  | |
| 支持:不支持 | 在差异模式下,将返回有关已更改内容(或可能需要在  | 
另请参阅
另请参阅
- community.hrobot.ssh_key_info
- 查询 SSH 密钥信息 
示例
- name: Add an SSH key
  community.hrobot.ssh_key:
    hetzner_user: foo
    hetzner_password: bar
    state: present
    name: newKey
    public_key: ssh-rsa AAAAB3NzaC1yc+...
- name: Remove a SSH key by fingerprint
  community.hrobot.ssh_key:
    hetzner_user: foo
    hetzner_password: bar
    state: absent
    fingerprint: cb:8b:ef:a7:fe:04:87:3f:e5:55:cd:12:e3:e8:9f:99
返回值
常见的返回值已在 此处 记录,以下是此模块特有的字段
| 密钥 | 描述 | 
|---|---|
| 密钥的 MD5 指纹。 这是用于引用 SSH 公钥的值,例如在 community.hrobot.boot 模块中。 返回:成功 示例: | 
