community.general.scaleway_sshkey 模块 – Scaleway SSH 密钥管理模块

注意

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

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

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

要在 playbook 中使用它,请指定:community.general.scaleway_sshkey

概要

参数

参数

注释

api_timeout

别名: timeout

整数

连接 Scaleway API 的 HTTP 超时时间,以秒为单位。

默认值: 30

api_token

别名: oauth_token

字符串 / 必需

Scaleway OAuth 令牌。

api_url

别名: base_url

字符串

Scaleway API URL。

默认值: "https://account.scaleway.com"

query_parameters

字典

传递给查询字符串的参数列表。

默认值: {}

ssh_pub_key

字符串 / 必需

要添加的公钥 SSH 密钥字符串。

state

字符串

指示 SSH 密钥的所需状态。

选择

  • "present" ← (默认)

  • "absent"

validate_certs

布尔值

验证 Scaleway API 的 SSL 证书。

选择

  • false

  • true ← (默认)

属性

属性

支持

描述

check_mode

支持: 完整

可以在 check_mode 中运行,并返回更改状态预测,而无需修改目标。

diff_mode

支持:

当处于差异模式时,将返回有关已更改(或可能需要在 check_mode 中更改)的详细信息。

注释

注意

示例

- name: "Add SSH key"
  community.general.scaleway_sshkey:
    ssh_pub_key: "ssh-rsa AAAA..."
    state: "present"

- name: "Delete SSH key"
  community.general.scaleway_sshkey:
    ssh_pub_key: "ssh-rsa AAAA..."
    state: "absent"

- name: "Add SSH key with explicit token"
  community.general.scaleway_sshkey:
    ssh_pub_key: "ssh-rsa AAAA..."
    state: "present"
    oauth_token: "6ecd2c9b-6f4f-44d4-a187-61a92078d08c"

返回值

通用返回值记录在 此处,以下是此模块独有的字段

描述

数据

字典

仅当 state=present 时才会出现。

返回:state=present

示例: {"ssh_public_keys": [{"key": "ssh-rsa AAAA...."}]}

作者

  • Remy Leone (@remyleone)