# Inventory

**URL:** <https://forum.ansible.com/t/inventory/27058>\
**Category:** Ansible Project\
**Created:** [March 20, 2018, 7:14pm UTC](https://forum.ansible.com/t/inventory/27058 "2018-03-20T19:14:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vino\_B](https://avatars.discourse-cdn.com/v4/letter/v/839c29/32.png) [@Vino\_B](https://forum.ansible.com/u/Vino_B)\
**Post date:** [March 20, 2018, 7:14pm UTC](https://forum.ansible.com/t/inventory/27058/1 "2018-03-20T19:14:52Z")

</div>

Hi All,

Can someone provide me an example on how to accomplish the below task,

I have 10 task, I need to execute 5 task on all the host which are under the group test in the inventory file and task 6-8 on first 2 servers only and the task 9-10 to the last server only.

Host file  
[test]  
Server1  
Server2  
Server3

From,  
Vino.B

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [March 20, 2018, 7:36pm UTC](https://forum.ansible.com/t/inventory/27058/2 "2018-03-20T19:36:45Z")

</div>

- hosts: test  
&nbsp;&nbsp;tasks:  
&nbsp;&nbsp;&nbsp;&nbsp;- task1  
&nbsp;&nbsp;&nbsp;&nbsp;- task2  
&nbsp;&nbsp;&nbsp;&nbsp;- task3  
&nbsp;&nbsp;&nbsp;&nbsp;- task4  
&nbsp;&nbsp;&nbsp;&nbsp;- task5

- hosts: test[0], test[1]  
&nbsp;&nbsp;tasks:  
&nbsp;&nbsp;&nbsp;&nbsp;- task6  
&nbsp;&nbsp;&nbsp;&nbsp;- task7  
&nbsp;&nbsp;&nbsp;&nbsp;- task8

- hosts: test[-1]  
&nbsp;&nbsp;tasks:  
&nbsp;&nbsp;&nbsp;&nbsp;- task9  
&nbsp;&nbsp;&nbsp;&nbsp;- task10
