I am using ansible 2.9.4 and trying to setup a playbook for provisioning vultr servers.
Using the vultr_server
module (which works fine) i noticed the ssh_keys
parameter. The only documentation provided is "List of SSH key names or IDs passed to the server on creation.".
What functionality is provided? Can someone provide an example?
Relevant task:
- 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
Tasks execution succeeded and a new running instance is available. However, no authorized_keys
(no .ssh
directory at all).
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