ansible 模块 vultr_server 中 ssh_keys 参数的示例
Example for ssh_keys parameter in ansible module vultr_server
我正在使用 ansible 2.9.4 并尝试设置一个用于配置 vultr 服务器的剧本。
使用 vultr_server
模块(工作正常)我注意到 ssh_keys
参数。提供的唯一文档是 "List of SSH key names or IDs passed to the server on creation.".
提供了什么功能?有人可以举个例子吗?
相关任务:
- name: Ensure a cloud server exists
local_action:
module: vultr_server
name: "{{ inventory_hostname_short }}"
ipv6_enabled: yes
private_network_enabled: no
os: "Debian 10 x64 (buster)"
plan: "4096 MB RAM,128 GB SSD,3.00 TB BW"
region: Amsterdam
ssh_keys:
- id_rsa
register: result
任务执行成功,新的 运行 实例可用。但是,没有 authorized_keys
(根本没有 .ssh
目录)。
The name of the ssh_keys
must match the name of the keys known by vultr. You can create these public named keys via the web console (https://my.vultr.com): Products -> SSH Keys -> Add SSH key.
The specified public keys will be added to ~/.ssh/authorized_keys
(file will be created automatically).
References
我正在使用 ansible 2.9.4 并尝试设置一个用于配置 vultr 服务器的剧本。
使用 vultr_server
模块(工作正常)我注意到 ssh_keys
参数。提供的唯一文档是 "List of SSH key names or IDs passed to the server on creation.".
提供了什么功能?有人可以举个例子吗?
相关任务:
- name: Ensure a cloud server exists
local_action:
module: vultr_server
name: "{{ inventory_hostname_short }}"
ipv6_enabled: yes
private_network_enabled: no
os: "Debian 10 x64 (buster)"
plan: "4096 MB RAM,128 GB SSD,3.00 TB BW"
region: Amsterdam
ssh_keys:
- id_rsa
register: result
任务执行成功,新的 运行 实例可用。但是,没有 authorized_keys
(根本没有 .ssh
目录)。
The name of the ssh_keys
must match the name of the keys known by vultr. You can create these public named keys via the web console (https://my.vultr.com): Products -> SSH Keys -> Add SSH key.
The specified public keys will be added to ~/.ssh/authorized_keys
(file will be created automatically).
References