# Using --limit working on hosts with multiple tasks

**URL:** <https://forum.ansible.com/t/using-limit-working-on-hosts-with-multiple-tasks/14832>\
**Category:** Ansible Project\
**Created:** [March 22, 2014, 6:31pm UTC](https://forum.ansible.com/t/using-limit-working-on-hosts-with-multiple-tasks/14832 "2014-03-22T18:31:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike\_Cavedon](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@Mike\_Cavedon](https://forum.ansible.com/u/Mike_Cavedon)\
**Post date:** [March 22, 2014, 6:31pm UTC](https://forum.ansible.com/t/using-limit-working-on-hosts-with-multiple-tasks/14832/1 "2014-03-22T18:31:29Z")

</div>

Hi,

I have the following set-up:

[hosts]  
am[201:205]  
am[301:305]

[matcher:children]  
hosts

[memcached:children]  
hosts

I’m expecting to be able to use “–limit matcher” and have only the tasks associated with “matcher” executed on the hosts but the tasks associated with “memcached” are also being executed. If I’m not doing something incorrectly how do I get only the tasks associated with “matcher” to execute on the hosts associated with both “matcher” and “memcached”?

Thanks.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [March 22, 2014, 6:58pm UTC](https://forum.ansible.com/t/using-limit-working-on-hosts-with-multiple-tasks/14832/2 "2014-03-22T18:58:11Z")

</div>

Groups select hosts not tasks, I see the group “hosts” in both groups so this is correct.

Consider tagging or splitting your playbooks.

– Michael

---

<div class="post-metadata">

**Author:** ![Mike\_Cavedon](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@Mike\_Cavedon](https://forum.ansible.com/u/Mike_Cavedon)\
**Post date:** [March 22, 2014, 7:39pm UTC](https://forum.ansible.com/t/using-limit-working-on-hosts-with-multiple-tasks/14832/3 "2014-03-22T19:39:06Z")

</div>

I even tried the following:

[matcher:children]

am[201:205]  
am[301:305]

[memcached:children]

am[201:205]  
am[301:305]

I called the playbook with “–limit matcher”.

Stuff for “- hosts: matcher\_memcached” still executed.

No need to respond if this is expected. I will look into tags or splitting.

Thanks for the response, especially so quickly on the weekend.

Mike

---

<div class="post-metadata">

**Author:** ![Mike\_Cavedon](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@Mike\_Cavedon](https://forum.ansible.com/u/Mike_Cavedon)\
**Post date:** [March 22, 2014, 7:39pm UTC](https://forum.ansible.com/t/using-limit-working-on-hosts-with-multiple-tasks/14832/4 "2014-03-22T19:39:44Z")

</div>

Typo…

Stuff for “- hosts: memcached” still executed.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [March 22, 2014, 7:55pm UTC](https://forum.ansible.com/t/using-limit-working-on-hosts-with-multiple-tasks/14832/5 "2014-03-22T19:55:19Z")

</div>

Still as designed…

– Michael

---

<div class="post-metadata">

**Author:** ![Walid](https://avatars.discourse-cdn.com/v4/letter/w/ea5d25/32.png) [@Walid](https://forum.ansible.com/u/Walid)\
**Post date:** [March 22, 2014, 7:56pm UTC](https://forum.ansible.com/t/using-limit-working-on-hosts-with-multiple-tasks/14832/6 "2014-03-22T19:56:18Z")

</div>

the group with children have to have child groups entries not hosts , not child hosts
