community.hrobot.ssh_key (1.9.1) — module

Add, remove or update SSH key

| "added in version" 1.2.0 of community.hrobot"

Authors: Felix Fontein (@felixfontein)

Install collection

Install with ansible-galaxy collection install community.hrobot:==1.9.1


Add to requirements.yml

  collections:
    - name: community.hrobot
      version: 1.9.1

Description

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

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Add an SSH key
  community.hrobot.ssh_key:
    hetzner_user: foo
    hetzner_password: bar
    state: present
    name: newKey
    public_key: ssh-rsa AAAAB3NzaC1yc+...
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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

Inputs

    
name:
    description:
    - The public key's name.
    - Required if O(state=present), and ignored if O(state=absent).
    type: str

state:
    choices:
    - present
    - absent
    description:
    - Whether to make sure a public SSH key is present or absent.
    - V(present) makes sure that the SSH key is available, and potentially updates names
      for existing SSH public keys.
    - V(absent) makes sure that the SSH key is not available. The fingerprint or public
      key data is used for matching the key.
    required: true
    type: str

public_key:
    description:
    - The public key data in OpenSSH format.
    - 'Example: V(ssh-rsa AAAAB3NzaC1yc+...)'
    - One of O(public_key) and O(fingerprint) are required if O(state=absent).
    - Required if O(state=present).
    type: str

fingerprint:
    description:
    - The MD5 fingerprint of the public SSH key to remove.
    - One of O(public_key) and O(fingerprint) are required if O(state=absent).
    type: str

hetzner_user:
    description: The username for the Robot webservice user.
    required: true
    type: str

hetzner_password:
    description: The password for the Robot webservice user.
    required: true
    type: str

Outputs

fingerprint:
  description:
  - The MD5 fingerprint of the key.
  - This is the value used to reference the SSH public key, for example in the M(community.hrobot.boot)
    module.
  returned: success
  sample: cb:8b:ef:a7:fe:04:87:3f:e5:55:cd:12:e3:e8:9f:99
  type: str

See also