An ansible role to manage users on linux hosts.
Requires a custom authorized_keys
location (/etc/ssh/authorized_keys/
) to be setup.
You can configure this using the thedumbtechguy.server-setup role.
This role has been tested on
Ubuntu 16.04
andUbuntu 16.10
only.
users
: list of users to create.- Default:
[]
- Example
users: - username: username # required password: 'encryptedpassword' # optional. omitted if not provided use_ssh: false # optional. defaults to false public_key: 'key url or contents' # required when 'use_ssh' is true use_sudo: false # optional. defaults to false sudo: hosts: ALL # optional. defaults to 'ALL' groups: ALL # optional. defaults to 'ALL' users: ALL # optional. defaults to 'ALL' commands: ALL # optional. defaults to 'ALL'. for passwordless sudo, use 'NOPASSWD: ALL'
Note: Password should be an encrypted value compatible with the ansible user module.
You can create one using:
python -c 'import crypt; print crypt.crypt("This is the password", "$1$ThisIsSomeSalt$")'
- Default:
- hosts: all
vars:
users:
- username: admin
password: '$1$ThisIsSo$RwIOJHdSWIzAJjbvBdbOZ0'
use_sudo: true
use_ssh: false
- username: ansible
password: '$1$ThisIsSo$RwIOJHdSWIzAJjbvBdbOZ0'
use_ssh: true
public_key: 'ssh-rsa AAAA......'
use_sudo: true
sudo:
hosts: ALL
groups: ALL
users: ALL
commands: ALL
roles:
- thedumbtechguy.manage-users
MIT / BSD
This role was created by TheDumbTechGuy ( twitter | blog | galaxy )