arillso.users

Ansible Role: users

Important Update

The ansible.users role has been moved to a new collection and will not be developed in this repository anymore. For the latest features and updates, visit the new collection at https://github.com/arillso/ansible.system/tree/main/roles/users. We suggest all users switch to the updated role for ongoing support.

Description

This Ansible role helps manage users and their authorized keys on Linux and Windows systems.

Installation

ansible-galaxy install arillso.users

Requirements

None

Role Variables

Users

You can specify a list of users to add:

users: []

You can also define a list of users by host variables:

users_list_host: []

And a list of users by group variables:

users_list_group: []

Example

Here’s how to define a user:

users:
  - username: foobar              # (required)
    name: Foo Bar
    uid: 1000
    group: staff
    password: xxxxx               # (use a hash created with: mkpasswd)
    groups: ["adm", "www-data"]
    append: no                    # (only add to groups, keep others)
    home_mode: "0750"
    home_create: yes
    home: /path/to/user/home
    system: no
    authorized_keys: []
    authorized_keys_exclusive: yes
    ssh_key_type: rsa
    ssh_key_bits: 2048
    ssh_key_password: ""
    ssh_key_generate: no
    ssh_key: "xxx"
    shell: /bin/bash
    update_password: always

Another example with fewer fields:

users:
  - username: foobar              # (required)
    name: Foo Bar
    description: User
    password: xxxxx
    groups: ['adm', 'www-data']
    hide: true

Specify the home directory for users:

users_home: /home

Set the default primary group for users:

users_group:

Set the default secondary groups:

users_groups: []

Default permissions for user home directories:

users_home_mode: '0755'

Default SSH key type:

users_ssh_key_type: rsa

Default SSH key bits:

users_ssh_key_bits: 2048

Default setting for exclusive authorized keys:

users_authorized_keys_exclusive: 'no'

Dependencies

None

Example Playbook

- hosts: all
  roles:
    - arillso.users

Author

Inspiration

License

This project is licensed under the MIT License. See the LICENSE file for details.

(c) 2020, Arillso

Informazioni sul progetto

Role to manage users on Linux and Windows.

Installa
ansible-galaxy install arillso.users
Licenza
mit
Download
611.8k
Proprietario