ssh-key-exists

Example:

# Create an ssh key with empty password for the current user.
- ssh-key-exists:
    path: /home/markus/.ssh/id_rsa

Description

Ensures an ssh key exists for a user.

If the ssh key already exists, the password argument is ignored.

Variables

Name Type Default Description

path

string --

The absolute path to the private ssh key.

The path to the public key will be infered (added '.pub'). Required

password

string --

The password to unlock the key (only used if key doesn't exist already).

user

string --

The name of the ssh key owner.

Examples

Example 1

Create an ssh key with empty password for the current user.

Code
- ssh-key-exists:
    path: /home/markus/.ssh/id_rsa
Description

The path needs to be provided as absolute, relative paths won't work (yet).

Example 2

Create an ssh key for the 'admin' user (create user if necessary), use password: 'password123' to encrypt the key.

Code
- ssh-key-exists:
    path: /home/admin/.ssh/id_rsa
    user: admin
    password: password123

Command-line

frecklecute ssh-key-exists --help

Usage: frecklecute ssh-key-exists [OPTIONS]

  Ensures an ssh key exists for a user.

  If the ssh key already exists, the password argument is ignored.

Options:
  --path PATH          The (absolute!) path to the (private) ssh key.
                       [required]
  --password PASSWORD  The password to unlock the key (only used if key
                       doesn't exist already).
  --user USER          The name of the ssh key owner.
  --help               Show this message and exit.