Unable to figure out arrays

I would like to be able to put my users into a list and be able to select what user has access to each machine.

Please ignore the second mail: under bob

Hi Michael, I think you want something like:

Thanks for your response Michael. I've already read through that page
a few times. It does not work for me because I need an array of users,
and then I need to be able to select which user have access to each
class of server. This method would give every user access to every
machine. I need to be able to specify something like with items -
users.alice - users.bob and not have carol included.

for that just do :

vars:
  ....
    allowed_users_host1: ['alice,'bob']
....
    - name: Add user
      debug: msg="Add user {{ item.key }} password {{ item.value.pass }}"
      with_dict: users
      when: item.key in allowed_users_host1

- name: foo
   shell: echo "{{ users[item].name }}"
   with_items:
    - alice
    - bob

Awesome! Thank you so much for your responses Michael, Brian, and
Adam. Both solutions from Brian and Adam work, thank you! If any of
you get to Los Angeles I owe you a drink!

This is working great:

  - name: Users | create .gitconfig
    shell: git config --global user.name '{{ item.value.name }}'; git
config --global user.email '{{ item.value.mail }}'
    args:
      creates: /home/{{ item.key }}/.gitconfig
    sudo: yes
    sudo_user: "{{ item.key }}"
    with_dict: users
    when: item.key in allowed_users_dev
    tags: git

What I like about the with_dict approach is I can do "when: item.key
not in allowed_users_dev" with "user: name={{ item.key }}
state=absent".