user-exists

Example:

# Create (if not already exist) user and group 'freckles', with gid/uid 1111.
- user-exists:
    name: freckles
    uid: 1111
    group: freckles
    gid: 1111

Description

Ensure a user exists on a system.

If no password argument is provided, the created user won't be able do login via ssh via password auth, and they won't be able to do sudo if passwordless sudo is not enabled for the user.

This task allows for providing the password in plain text. It will

Optionally, you can specify UID, main group and GID of the user. If the group var is specified, a corresponding group will be created if it doesn't exist yet.

Resources

Variables

Name Type Default Description

name

string --

The name of the user to create. Required

gid

integer --

The GID of the users main group (optional).

group

string --

The name of the users main group.

password

string --

This sets the users password. The user input will be sha512-hashed before forwareded to the connector.

If not provided, the user won't be able to login via password auth, and can't do sudo if passwordless sudo is not configured.

shell

string /bin/bash

The users default shell.

system_user

boolean --

Whether the user to create (and potentially group) should be created as system user.

uid

integer --

The uid of the user to create (optional).

Examples

Example 1

Create (if not already exist) user and group 'freckles', with gid/uid 1111.

Code
- user-exists:
    name: freckles
    uid: 1111
    group: freckles
    gid: 1111
Description

This (obviously) assigns the 'freckles' group to be the new users main group.

Command-line

frecklecute user-exists --help

Usage: frecklecute user-exists [OPTIONS] USER_NAME

  Ensure a user exists on a system.

  If no ``password`` argument is provided, the created user won't be able do
  login via ssh via password auth, and they won't be able to do sudo if
  passwordless sudo is not enabled for the user.

  This task allows for providing the password in plain text. It will

  Optionally, you can specify UID, main group and GID of the user. If the
  ``group`` var is specified, a corresponding group will be created if it
  doesn't exist yet.

Options:
  --gid GID                       The GID of the users main group (optional).
  --group GROUP_NAME              The name of the users main group.
  --password PWD                  The user password in plain text.
  --shell SHELL                   The users default shell.  [default:
                                  /bin/bash]
  --system-user / --no-system-user
                                  Whether the user to create (and potentially
                                  group) should be created as system user.
  --uid UID                       The uid of the user to create (optional).
  --help                          Show this message and exit.