W3cubDocs

/Ansible 2.9

hcloud_ssh_key – Create and manage ssh keys on the Hetzner Cloud

New in version 2.8.

Synopsis

  • Create, update and manage ssh keys on the Hetzner Cloud.

Requirements

The below requirements are needed on the host that executes this module.

  • hcloud-python >= 1.0.0

Parameters

Parameter Choices/Defaults Comments
api_token
string / required
This is the API Token for the Hetzner Cloud.
endpoint
string
Default:
"https://api.hetzner.cloud/v1"
This is the API Endpoint for the Hetzner Cloud.
fingerprint
string
The Fingerprint of the Hetzner Cloud ssh_key to manage.
Only required if no ssh_key id or name is given.
id
integer
The ID of the Hetzner Cloud ssh_key to manage.
Only required if no ssh_key name is given
labels
dictionary
User-defined labels (key-value pairs)
name
string
The Name of the Hetzner Cloud ssh_key to manage.
Only required if no ssh_key id is given or a ssh_key does not exists.
public_key
string
The Public Key to add.
Required if ssh_key does not exists.
state
string
    Choices:
  • absent
  • present
State of the ssh_key.

See Also

See also

Documentation for Hetzner Cloud API
Complete reference for the Hetzner Cloud API.

Examples

- name: Create a basic ssh_key
  hcloud_ssh_key:
    name: my-ssh_key
    public_key: "ssh-rsa AAAjjk76kgf...Xt"
    state: present

- name: Create a ssh_key with labels
  hcloud_ssh_key:
    name: my-ssh_key
    public_key: "ssh-rsa AAAjjk76kgf...Xt"
    labels:
        key: value
        mylabel: 123
    state: present

- name: Ensure the ssh_key is absent (remove if needed)
  hcloud_ssh_key:
    name: my-ssh_key
    state: absent

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
hcloud_ssh_key
complex
Always
The ssh_key instance

fingerprint
string
Always
Fingerprint of the ssh_key

Sample:
b7:2f:30:a0:2f:6c:58:6c:21:04:58:61:ba:06:3b:2f
id
integer
Always
ID of the ssh_key

Sample:
12345
labels
dictionary
Always
User-defined labels (key-value pairs)

Sample:
{'key': 'value', 'mylabel': 123}
name
string
Always
Name of the ssh_key

Sample:
my-ssh-key
public_key
string
Always
Public key of the ssh_key

Sample:
ssh-rsa AAAjjk76kgf...Xt


Status

Authors

  • Lukas Kaemmerling (@LKaemmerling)

Hint

If you notice any issues in this documentation, you can edit this document to improve it.

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.9/modules/hcloud_ssh_key_module.html