manala.accounts

#######################################################################################################

:exclamation: DEPRECATION :exclamation:

This repository and its associated role are no longer supported. Please use the Manala Ansible Collection instead.

You can find more information on how to use it in the collection repository.

#######################################################################################################

Ansible Role: Accounts Build Status

:exclamation: Please report issues and submit Pull Requests in the main Ansible Role repository :exclamation:

This role is for setting up user accounts, groups, and SSH keys.

It's part of the Manala Ansible stack but can also be used independently.

Requirements

None.

Dependencies

None.

Installation

Ansible 2+

To install using the Ansible Galaxy command line:

ansible-galaxy install manala.accounts

Or, if using a requirements file:

- src: manala.accounts

Role Handlers

None

Role Variables

Name Default Type Description
manala_accounts_users Array Array List of Unix users.
manala_accounts_users.user - String Username.
manala_accounts_users.group - String User's main group.
manala_accounts_users.groups - Array Array of user's secondary groups.
manala_accounts_groups - Array Array of groups to be created.
manala_accounts_groups.name - String Name of the group to manage.
manala_accounts_groups.system - Boolean Indicates if the group is a system group.

Defining users

Use the manala_accounts_users key to define users, which includes:

  • A username
  • A main group
  • Some secondary groups
  • Authorized SSH keys
  • Private/public keys

Example

manala_accounts_users:
  - user:   foo
    group:  users
    groups: ['sudo']
    authorized_keys_file: authorized_keys2 # default is authorized_keys
    authorized_keys:
      - "{{ query('file', playbook_dir ~ '/files/users/keys/[email protected]') }}"
      - "no-port-forwarding,from=\"10.0.1.*\" {{ query('file', playbook_dir ~ '/files/users/keys/[email protected]') }}"
    keys:
      - name:    id_rsa
        public:  "{{ query('file', playbook_dir ~ '/files/users/keys/[email protected]') }}"
        private: "{{ query('file', playbook_dir ~ '/files/users/keys/[email protected]') }}"
    gpg_keys:
      - key:    FOOOBAAR
        public: "{{ query('file', playbook_dir ~ '/files/users/gpg_keys/[email protected]') }}"
        secret: "{{ query('file', playbook_dir ~ '/files/users/gpg_keys/[email protected]') }}"

Example: Removing a user

manala_accounts_users:
  - user:   bar
    state:  absent
  # Include more users
  - "{{ my_custom_users_array }}"

Example: Trusting GPG keys

  - user: root
    gpg_keys:
      - key: foobar
        public: "{{ query('file', playbook_dir ~ '/files/foobar.gpg.key') }}"
        trust: true

Creating a group

You can create a group using manala_accounts_groups by specifying:

  • A group name
  • If the group is a "system group"

Example

manala_accounts_groups:
  - group: ops
    system: false
  # Include more groups
  - "{{ my_custom_groups_array }}"

Example playbook

- hosts: servers
  roles:
    - role: manala.accounts

License

MIT

Author information

Manala (http://www.manala.io/)

Informazioni sul progetto

Handle accounts users and groups

Installa
ansible-galaxy install manala.accounts
Licenza
Unknown
Download
6.7k
Proprietario
Manala is an open source project supported by the french web agency ELAO providing advanced ansible roles for website's infrastructures and far more.