Skip to content

markahesketh/ansible-role-users

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ansible Role: Users and Groups

Build Status

Ansible role for managing system users and groups.

Installation

$ ansible-galaxy install markahesketh.users

Role Variables

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.

Dependencies

None

Example Playbook

- hosts: web
  roles:
     - { role: markahesketh.users }

Example Usage

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"

Author

License

Available under the MIT license.

Releases

No releases published

Packages

No packages published