admin-user-exists

Example:

# Create admin user with passwordless-sudo enabled, and ssh-keys added.
- admin-user-exists:
    user_name: admin
    ssh_keys:
    - ssh-rsa AAAAB3NzaC1yc2EAAAADAQA....
    passwordless_sudo: true

Description

Create an admin user with an (optionally) provided password (hashed, for details see: Ansible user module).

If no admin_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.

Also lets you choose the default shell of that user, provide public ssh keys, and whether passwordless sudo should be enabled for the user.

Variables

Name Type Default Description

user_name

string --

The username of the admin user. Required

admin_password

string --

This sets the users password in plain text. 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.

passwordless_sudo

boolean False

Whether to enable passwordless sudo for this user.

shell

string /bin/bash

Default shell of admin user.

ssh_keys

list --

A list of public ssh keys for this admin user.

Examples

Example 1

Create admin user with passwordless-sudo enabled, and ssh-keys added.

Code
- admin-user-exists:
    user_name: admin
    ssh_keys:
    - ssh-rsa AAAAB3NzaC1yc2EAAAADAQA....
    passwordless_sudo: true
Description

Create

Command-line

frecklecute admin-user-exists --help

Usage: frecklecute admin-user-exists [OPTIONS] USER_NAME

  Create an admin user with an (optionally) provided password (hashed, for
  details see: [Ansible user module](https://docs.ansible.com/ansible/latest
  /modules/user_module.html)).

  If no ``admin_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.

  Also lets you choose the default shell of that user, provide public ssh
  keys, and whether passwordless sudo should be enabled for the user.

Options:
  --admin-password PWD            The user password.
  --passwordless-sudo / --no-passwordless-sudo
                                  Whether to enable passwordless sudo for this
                                  user.
  --shell SHELL                   Default shell of admin user.  [default:
                                  /bin/bash]
  --ssh-keys KEY                  A list of public ssh keys for this admin
                                  user.
  --help                          Show this message and exit.