Accounts
Table of Contents
- Overview
- Requirements
- Role Variables
- Dependencies
- Examples
- Development / Contributing
- License
- Author Information
Overview
Generic user account and group management
Requirements
This role requires Ansible 2.3 or higher and platform requirements are listed in the metadata file.
Role Variables
The variables that can be passed to this role and a brief description about them are as follows. (For all variables, take a look at defaults/main.yml)
Name | Default | Type | Description |
---|---|---|---|
accounts_groups |
- | Array | List of unix groups |
accounts_users |
- | Array | List of unix users |
Accounts_Groups
All parameters for defining a group within the accounts_group
array variable
are inline with parameters defined in the
Group Module
Accounts_Users
Parameters for defining a user within the accounts_users
array variable
trend to the defaults listed in the
User Module
unless stated below
Name | Default | Type | Notes |
---|---|---|---|
group | item.name |
String | The primary user group is set to be the same value as the user name. If a group that doesn't match the user name is desired it must be created within the accounts_groups array or be already available on the system. |
groups | - | Array | A list of additional groups the user is a memeber of |
password | item.password |
String/Hash | If a single crypted value is supplied it sets the users password to that value. There are different crypted methods for various operating systems, a hash can be created based on the ansible_os_family . See the below example Playbooks |
Dependencies
None
Examples
Example Playbook
See the Molecule testing Playbook for an example
Example Variable Definition
The accounts_groups
and accounts_users
list varaiables can be
declared at any precedence level.
For the most flexibility my recomendation is to declare them at the
inventory group_vars level
## Create Groups ##
accounts_groups:
- name: monkeys
gid: 2000
## Create Account/Users ##
accounts_users:
- name: tmonkey1
comment: 'Test Monkey 1'
uid: 1006
password:
OpenBSD: "$2b$08$3eBhGgrLIXZP8Ewh8tqXtuh38M463K2rKYJSyUgATRKQNX70b2jyG"
FreeBSD: "$1$N0JqVxf/$iSmuQ6lyKB/GJUe52DqFw/"
RedHat: "$1$N0JqVxf/$iSmuQ6lyKB/GJUe52DqFw/"
groups:
- wheel
authorized_keys:
- key: 'ssh-dss FAKEKEYSUTFF== tmonkey1'
state: present
Development / Contributing
See Contributing.
This role has been tested against the following distributions and Ansible version:
Distribution | Ansible 2.3 | Ansible 2.4 | Ansible 2.5 | Ansible 2.6 |
---|---|---|---|---|
Centos 6 | Yes | Yes | Yes | Yes |
Centos 7 | Yes | Yes | Yes | Yes |
Ubuntu 18.04 | Yes | Yes | Yes | Yes |
Ubuntu 18.10 | Yes | Yes | Yes | Yes |
FreeBSD 11.2 | Yes | Yes | Yes | Yes |
OpenBSD 6.3 | Yes | Yes | Yes | Yes |
License
Licensed under the MIT License. See the LICENSE file for details.
Author Information
- Steven Bambling