Git Product home page Git Product logo

ansible-role-user's Introduction

User

A role for managing users. Originally by Gertjan Roggemans, forked by Dylan Humphreys

Following roles where designed to neatly work together with this role:

The management-user role combines all these roles in one easy to use role.

Requirements

  • Hosts should be bootstrapped for ansible usage (have python,...)
  • Root privileges, eg become: yes
  • useradd, userdel and usermod should be available on the host

Role Variables

Variable Description Default value
user_list List of users (see details!) []
user_list_host List of users (see details!) []
user_list_group List of users (see details!) []
user_append Default value for append no
user_createhome Default value for createhome yes
user_force Default value for force no
user_generate_ssh_key Default value for generate_ssh_key no
user_move_home Default value for move_home no
user_none_unique Default value for none_unique no
user_remove Default value for remove no
user_shell Default value for shell '/bin/sh'
user_ssh_key_bits Default value for ssh_key_bits 4096
user_ssh_key_file Default value for ssh_key_file '.ssh/id_rsa'
user_system Default value for system no
user_update_password Default value for update_password always

user_list details

user_list, user_list_host and user_list_group are merged when managing the users. You can use the host and group lists to specify users per host or group off hosts.

The user list allows you to define which users must be managed. Each item in the list can have following attributes:

Variable Description Required Default
append Only append to groups? no user_append
comment User description (aka GECOS) no /
createhome Create home directory? no user_createhome
expires Expiry data no /
force Use --force option when deleting a user no user_force
generate_ssh_key Generate ssh key? no user_generate_ssh_key
group Users primary group no /
groups List of groups for the user no /
home Home directory for the user no /
login_class Login class for BSD systems no /
move_home Move home directory no user_move_home
name User name yes /
non_unique Allow none unique uid no user_none_unique
password Password for the user no /
remove Use --remove option when deleting a user no user_remove
shell Users shell no user_shell
ssh_key_bits SSH key size no user_ssh_key_bits
ssh_key_comment SSH key comment no /
ssh_key_file SSH key file no user_ssh_key_file
ssh_key_passphrase SSH key passphrase no /
ssh_key_type SSH key type no rsa
state User state no 'present'
system System account? no user_system
uid User id no /
update_password Update password if changed? no user_update_password
Example user_list
user_list:
  - name: user1
  - name: user2
    uid: 1001
    groups:
      - test
      - sudo
  - name: user3
    uid: 1002
    state: absent

Dependencies

None.

Example Playbook

---
- hosts: servers
  roles:
  - { role: GROG.user, become: yes }

Inside group_vars/servers.yml:

user_list_group:
  - name: user
    uid: 1001
  - name: test
    state: absent

Contributing

All assistance, changes or ideas welcome!

Author

By G. Roggemans

License

MIT

ansible-role-user's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.