Manage user and groups using Ansible
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
defaults
meta
tasks
tests
.gitignore
.kitchen.yml
.travis.yml
Gemfile
LICENSE
README.md

README.md

Ansible Role: users

Build Status Ansible Galaxy Ansible Galaxy

An Ansible role that manages users and groups on Debian/Ubuntu and RHEL/CentOS.

Installation

ansible-galaxy install linconf.users

Example Playbooks

Add a User

- hosts: localhost
  roles:
    - linconf.users
  vars:
    users_accounts:
      - name: 'NewUser'
        group: 'NewUser'
        # Additional Groups
        groups: ['wheel', 'users']
        password: '$6$c6pQJ3kzW80oZwTi$...'
        update_password: 'always'

See the Ansible user module for a full list of available options.

Password hash created using: mkpasswd --method=SHA-512

Remove a User

users_accounts:
  - name: 'NewUser'
    state: absent

Add a Group

users_groups:
  - name: 'NewGroup'

Whenever you add a user to a group that doesn't yet exist on the system (using the groups: option of users_accounts) you must also use users_groups to add the group to the system.

Additional Options

See the linconf.users documentation for a full list of available options.

Optionally, this role has 3 lists for users, and 3 lists for groups. This can be useful in situations where groups of hosts share the same users.

  • users_accounts: []
  • users_host_accounts: []
  • users_group_accounts: []
  • users_groups: []
  • users_host_groups: []
  • users_group_groups: []

Dependencies / Requirements

  • None

Testing

The master branch is continuously validated by Travis-CI.

Minor versions indicate the role passed local testing as described by the .kitchen declaration. Instructions for performing test-kitchen runs locally are detailed in the LinConf Documentation.

Author and License

Chad Sheets - GitHub | Blog | Email

Released under the MIT License

Analytics