community.hrobot.ssh_key – Add, remove or update SSH key

Note

This plugin is part of the community.hrobot collection (version 1.2.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install community.hrobot.

To use it in a playbook, specify: community.hrobot.ssh_key.

New in version 1.2.0: of community.hrobot

Synopsis

  • Add, remove or update an SSH key stored in Hetzner’s Robot.

Parameters

Parameter Choices/Defaults Comments
fingerprint
string
The MD5 fingerprint of the public SSH key to remove.
One of public_key and fingerprint are required if state=absent.
hetzner_password
string / required
The password for the Robot webservice user.
hetzner_user
string / required
The username for the Robot webservice user.
name
string
The public key's name.
Required if state=present, and ignored if state=absent.
public_key
string
The public key data in OpenSSH format.
Example: ssh-rsa AAAAB3NzaC1yc+...
One of public_key and fingerprint are required if state=absent.
Required if state=present.
state
string / required
    Choices:
  • present
  • absent
Whether to make sure a public SSH key is present or absent.
present makes sure that the SSH key is available, and potentially updates names for existing SHS public keys.
absent makes sure that the SSH key is not available. The fingerprint or public key data is used for matching the key.

See Also

See also

community.hrobot.ssh_key_info

Query information on SSH keys

Examples

- 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

Return Values

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

Key Returned Description
fingerprint
string
success
The MD5 fingerprint of the key.
This is the value used to reference the SSH public key, for example in the community.hrobot.boot module.

Sample:
cb:8b:ef:a7:fe:04:87:3f:e5:55:cd:12:e3:e8:9f:99


Authors

  • Felix Fontein (@felixfontein)

© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/hrobot/ssh_key_module.html