/
/
A generic Ansible role to create a single user with SSH access, optional keypair generation, dotfiles installation, and optional passwordless sudo.
Creates user and primary group
Adds user to extra groups
Sets home perms and .hushlogin
SSH setup:
Clone and install dotfiles (repo + install command)
Optional passwordless sudo
my_user_username
: username (default yannick
)my_user_groups
: list of extra groupsmy_user_password
: optional password (sha512 hashed on create)edge_device
: true
= import public key only, false
= generate keypair if missingmy_user_ssh_public_key
: explicit public keymy_user_github_username
: fetch .keys
from GitHubdotfiles_repo
: repo URLdotfiles_install_cmd
: command to run inside repomy_user_passwordless_sudo
: if true, grant NOPASSWD sudoNon-edge device:
- hosts: servers
vars:
my_user_username: yannick
my_user_groups: ['docker']
edge_device: false
my_user_github_username: yourname
dotfiles_repo: "https://github.com/yourname/dotfiles.git"
dotfiles_install_cmd: "./install.sh"
roles:
- my_user
Edge device:
- hosts: edge
vars:
my_user_username: yannick
edge_device: true
my_user_ssh_public_key: "ssh-ed25519 AAAAC..."
roles:
- my_user
community.crypto
collection for keypair generation.MIT