Ansible role for managing system users and groups.
$ ansible-galaxy install markahesketh.users
All available variables and default values are listed below. You may override these in your Playbook, group_vars
, command line etc.
# Default value
users_groups: []
# Available options
users_groups:
- name: "" # Group name
gid "" # (optional) Specify GID
system: no # (optional) Setting to 'yes' makes this user a system group
Groups to add / modify on the system. Takes optional parameters from the Group module.
# Default value
users_groups_removed: []
List of groups to remove from the system.
# Default value
users_users: []
# Available options
users_users:
- name: "" # Username
authorized_keys: [] # List of file paths to public keys to add to the user's authorized keys list
password: "" # (optional) Password
group: "" # (optional) Sets user's primary group
groups: [] # (optional) Groups to add the user to. Takes a YAML list.
comment: "" # (optional) User's description
home: "" # (optional) User's home directory
shell: "" # (optional) User's shell
uid: "" # (optional) User's UID
system: no # (optional) Setting to 'yes' makes this user a system account
generate_ssh_key: no # (optional) Create an SSH key for this user. Does not override an existing key
Users to add / modify on the system. Takes optional parameters from the Users module.
# Default value
users_users_removed: []
List of users to remove from the system.
None
- hosts: web
roles:
- { role: markahesketh.users }
users_groups:
- name: "winterfell"
- name: "nightswatch"
- name: "wildlings"
users_groups_removed:
- name: "targaryen"
users_users:
# Robb
- name: "robb"
group: "winterfell"
authorized_keys:
- "files/keys/ned.pub"
- "files/keys/robb-home-pc.pub"
# John
- name: "john"
group: "winterfell"
groups:
- "nightswatch"
- "wildlings"
generate_ssh_key: yes
authorized_keys:
- "files/keys/ned.pub"
- "files/keys/john-work.pub"
users_users_removed:
- name: "ned"
- name: "cat"
- Web: markhesketh.co.uk
- Email: contact@markhesketh.co.uk
- Twitter: twitter.com/markahesketh
- Github: github.com/markahesketh
Available under the MIT license.