Skip to content

🔧 An Ansible role to manage users, groups and authorized keys in Linux systems.

License

Notifications You must be signed in to change notification settings

aisbergg/ansible-role-linux-users

Repository files navigation

Ansible Role: aisbergg.linux_users

This Ansible role manages Linux users and groups. The role supports all relevant options of the Ansible user and group module. In addition it allows to manage the users SSH authorized keys and also allows to pass in passwords as plain text.

Requirements

If you want to pass plaintext passwords to the user module, you need to have the Python package passlib installed.

Role Variables

Variable Default Comments
linux_users [] List of users to be present or absent on the system. The options are the same as the options of the user module. The role provides also the options plain_password and authorized_key. The latter one can either be a string or a mapping as used by the authorized_key module.
linux_groups [] List of groups to be present or absent on the system. The options are the same as the options of the group module.
linux_users_hash_scheme sha512 The scheme used for hashing passwords, if passwords are passed in plain-text using the plain_password option.
linux_users_hash_rounds 29000 Rounds of hashing to be applied to plain-text passwords.

Example Playbook

- hosts: all
  vars:
    linux_users:
      - name: foo
        plain_password: "foobar"
        groups: sudo
        authorized_key: ssh-ed25519 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
        shell: /bin/zsh
        state: present

      - name: bar
        state: absent
        remove: true

      - name: yay
        uid: 991
        comment: "User for building and installing packages with YAY"
        shell: "/bin/bash"
        system: yes
        state: present

    linux_groups:
      - name: webteam
        state: present
        gid: 10000

      - name: nginx
        state: absent

  roles:
    - aisbergg.linux_users

License

MIT

Author Information

Andre Lehmann ([email protected])

About

🔧 An Ansible role to manage users, groups and authorized keys in Linux systems.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages