Skip to content
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.

Latest commit

 

History

History
250 lines (215 loc) · 9.4 KB

equinix.metal.sshkey_module.rst

File metadata and controls

250 lines (215 loc) · 9.4 KB

equinix.metal.sshkey

Create/delete an SSH key in Equinix Metal

Version added: 1.3.0

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

  • packet-python >= 1.43.1
Parameter Choices/Defaults Comments
api_token
string / required
The Equinix Metal API token to use
If not set, then the value of the METAL_API_TOKEN, PACKET_API_TOKEN, or PACKET_TOKEN environment variable is used.

aliases: auth_token
fingerprint
string
Fingerprint of the key which you want to remove.
id
string
UUID of the key which you want to remove.
key
string
Public Key string ({type} {base64 encoded key} {description}).
key_file
path
File with the public key.
label
string
Label for the key. If you keep it empty, it will be read from key string.

aliases: name
state
string
    Choices:
  • present ←
  • absent
Indicate desired state of the target.

# All the examples assume that you have your Equinix Metal API token in env var METAL_API_TOKEN.
# You can also pass the api token in module param api_token.

- name: Create sshkey from string
  hosts: localhost
  tasks:
    equinix.metal.sshkey:
      key: "{{ lookup('ansible.builtin.file', 'my_sshkey.pub') }}"

- name: Create sshkey from file
  hosts: localhost
  tasks:
    equinix.metal.sshkey:
      label: key from file
      key_file: ~/ff.pub

- name: Remove sshkey by id
  hosts: localhost
  tasks:
    equinix.metal.sshkey:
      state: absent
      id: eef49903-7a09-4ca1-af67-4087c29ab5b6

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

Key Returned Description
changed
boolean
always
True if a sshkey was created or removed.

Sample:
True
sshkeys
list
always
Information about sshkeys that were created/removed.

Sample:
[{'fingerprint': '5c:93:74:7c:ed:07:17:62:28:75:79:23:d6:08:93:46', 'id': '41d61bd8-3342-428b-a09c-e67bdd18a9b7', 'key': 'ssh-dss AAAAB3NzaC1kc3MAAACBAIfNT5S0ncP4BBJBYNhNPxFF9lqVhfPeu6SM1LoCocxqDc1AT3zFRi8hjIf6TLZ2AA4FYbcAWxLMhiBxZRVldT9GdBXile78kAK5z3bKTwq152DCqpxwwbaTIggLFhsU8wrfBsPWnDuAxZ0h7mmrCjoLIE3CNLDA/NmV3iB8xMThAAAAFQCStcesSgR1adPORzBxTr7hug92LwAAAIBOProm3Gk+HWedLyE8IfofLaOeRnbBRHAOL4z0SexKkVOnQ/LGN/uDIIPGGBDYTvXgKZT+jbHeulRJ2jKgfSpGKN4JxFQ8uzVH492jEiiUJtT72Ss1dCV4PmyERVIw+f54itihV3z/t25dWgowhb0int8iC/OY3cGodlmYb3wdcQAAAIBuLbB45djZXzUkOTzzcRDIRfhaxo5WipbtEM2B1fuBt2gyrvksPpH/LK6xTjdIIb0CxPu4OCxwJG0aOz5kJoRnOWIXQGhH7VowrJhsqhIc8gN9ErbO5ea8b1L76MNcAotmBDeTUiPw01IJ8MdDxfmcsCslJKgoRKSmQpCwXQtN2g== tomk@hp2', 'label': 'mynewkey33'}]


Authors