Skip to content

tfindley/ansible-role-localusergroup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Local Users and Groups

This is a very basic role for managing users and groups on a local Linux system

Requirements

This role has no requirements beyond that of Ansible

Role Variables

localusergroup_users - list of dictionaries containing the following

field type required default value example description
username string true
state string true present / absent
fname string true
sname string true
email string true
password string true
sudo bool false false true
groups list false
sshkeys list false

localusergroup_groups - list of dictionaries containing the following

field type required default value example description
name string true
state string true present / absent

Dependencies

A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.

Example Playbook

Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:

localusergroup_users:
  - username: "username"  # This user will be added
    state: present
    fname: "user"
    sname: "name"
    email: [email protected]
    password: 'set using openssl passwd -6'
    sudo: true
    groups:
      - "grouphere"
    sshkeys:
      - 'copypaste ssh key'
      - 'or use file read'
      - 'multiple_keys_can_be_used'

  - username: "another.user"  # This user will be removed
    state: absent

# Managing Groups
localusergroup_groups:
  - name: "infra"  # This group will be added
    state: present

Generate password

Preferred method:

set using openssl passwd -6

Alternative method:

python3 -c 'import crypt,getpass;pw=getpass.getpass();print(crypt.crypt(pw) if (pw==getpass.getpass("Confirm: ")) else exit())'

License

BSD

Author Information

Tristan Findley

Find out more about me here.

If you're fan of my work and would like to show your support:

ko-fi

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published