# Referencing/adapting global users list for different hosts

**URL:** <https://forum.ansible.com/t/referencing-adapting-global-users-list-for-different-hosts/25451>\
**Category:** Ansible Project\
**Created:** [September 11, 2017, 1:32pm UTC](https://forum.ansible.com/t/referencing-adapting-global-users-list-for-different-hosts/25451 "2017-09-11T13:32:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sim\_Tov](https://avatars.discourse-cdn.com/v4/letter/s/0ea827/32.png) [@Sim\_Tov](https://forum.ansible.com/u/Sim_Tov)\
**Post date:** [September 11, 2017, 1:32pm UTC](https://forum.ansible.com/t/referencing-adapting-global-users-list-for-different-hosts/25451/1 "2017-09-11T13:32:35Z")

</div>

Hello,

I would like to have a central global list of users with all relevant data, like this:

users:

- username: alice  
groups: adm, media, web  
sudo: yes  
shell: /bin/bash
- username: bob  
groups: web  
sudo: no  
shell: /bin/false
- username: eva  
groups: media, web  
sudo: no  
shell: /bin/bash  
…

in `group_vars/all.yml` (is it a good place for it?).

Now, I would like to be able to specify different subsets of that user list for different hosts and, if necessary, to override default data. Furthermore I want to only mention usernames, the rest of data should be taken from the global list, something like this:

host: db1  
users:

- alice
- bob

host: web2  
users:

- alice
- bob
- eva  
groups: media, web, adm

host: media1  
users:

- alice  
groups: web
- eva  
sudo: yes

What is the best way to organize it? Which files in which hierarchy? How should the task for user creation look like?

PS: is it wise to have users deleted if they disappear from global/host user lists? If yes - how do I implement this as well?..

Thank you!
