Ansible role to create admin and non-admin users on linux hosts.
This role is designed to manage linux hosts with the following roles. This role here basically only focuses on creating users and giving them admin rights depending on the configuration. Other roles distribute ssh public keys, configure sshd, roll out dotfiles or install a number of useful packages.
A list of suggested roles to manage your linux host:
- do1jlr.base install some useful packages
- do1jlr.users (this one)
- do1jlr.auth deploy ssh pubkeys
- do1jlr.sshd configure sshd
- do1jlr.dotfiles deploy some fancy dotfiles
The listed roles use the same variables to create accounts, admins and so on. But the roles have to run in the correct order to work properly. For example you can't deploy a ssh public key for a user that is not created.
-
admins
(default[]
):
A list ofssh
keys allowed to log in asroot
. -
accounts
(default[]
):
A list of usernames that will be created on this host, if they don't exisit -
default shell
(default/bin/bash
) -
manage_user_passwords
(defaultfalse
) manage user passwords? -
accounts_with_password
(default[]
) all users and password hashes
For aditional variables please have a look into defaults/main.yml
!
Alice and Bob may log in and are allowed to become root
with the sudo
command on this host:
admins:
- alice
- bob
Alice, Bob and Eve want to be users on this host:
# without password
accounts:
- alice
- bob
- eve
# with password
accounts_with_password:
alice:
- "$6$foo$LtJkKZx0ndF4kM0ImEtCaQhbMYWD.mlqatgAIzuDufGI0IGxe0wpSV7oXqwnLmO4MA.4A5JCnPhOqUyT3OfVV1"
bob:
- "$6$bar$fsDFaQrp1MI9yhNnoKlXJFfXSLpz/dpqWaA2NP/71WJUzfqQxPVvFY6Px7VlDppW/NB6Cbz6BjF2b9bD.riFX1"
eve:
- "$6$baz$7xpdAhdFpIM304YYQ88nz33xmJXnh5qxtlWoGSkc55a.R4DCRp62l.qhiYKbtjRzEjb5qnGoM9vthcHagPkyS/"
Use this to generate a password hash. (Obviously you have to replaceMyPassword
with your password!)
python3 -c 'import crypt; print(crypt.crypt("MyPassword"))'