# Help in expressing a task in ansible

**URL:** <https://forum.ansible.com/t/help-in-expressing-a-task-in-ansible/15723>\
**Category:** Ansible Project\
**Created:** [July 21, 2014, 1:39pm UTC](https://forum.ansible.com/t/help-in-expressing-a-task-in-ansible/15723 "2014-07-21T13:39:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raghu\_Udiyar](https://avatars.discourse-cdn.com/v4/letter/r/43a26b/32.png) [@Raghu\_Udiyar](https://forum.ansible.com/u/Raghu_Udiyar)\
**Post date:** [July 21, 2014, 1:39pm UTC](https://forum.ansible.com/t/help-in-expressing-a-task-in-ansible/15723/1 "2014-07-21T13:39:04Z")

</div>

Hello,

I have the following task for user management, that I’m trying to express in ansible :

User data is in a **users** key (vars/users.yml)  
Host group data is in a **host\_groups** keys ( vars/groups.yml)

The users key contains the list of users and their data, e.g. :

users:

- name: test
- shell: /bin/bash  
…

host\_groups:

- nginx : test1, test2, test3
- db : test3

What I want to do is write a playbook to iterate over the **host\_groups** , get the list of users to add, and then use the **users** key to get the data to add a user.

I have a **add\_user.yml** task that takes a user + host to add the user to. But to do this, I need something like :

tasks:

- include: add\_user.yml user=item.user  
with\_items:
- host\_groups

But I get a message that include+with\_items is deprecated. How do I get the above working? Or is there a better way to do this?

Thanks,  
Raghu
