# ansible-playbook --limit limitations?

**URL:** <https://forum.ansible.com/t/ansible-playbook-limit-limitations/15254>\
**Category:** Ansible Project\
**Created:** [May 16, 2014, 3:13pm UTC](https://forum.ansible.com/t/ansible-playbook-limit-limitations/15254 "2014-05-16T15:13:18Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dick\_Davies](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@Dick\_Davies](https://forum.ansible.com/u/Dick_Davies)\
**Post date:** [May 16, 2014, 3:13pm UTC](https://forum.ansible.com/t/ansible-playbook-limit-limitations/15254/1 "2014-05-16T15:13:18Z")

</div>

Hi,

I've got a fairly complex playbook which uses Ansibles  
orchestration features  
(i.e. "for n in groups['some group'] ....") and a big enough stack  
that I'd like to pass '--limit' to my plays as we build out configs etc.

An example: several servers lookup members of the 'zookeepers'  
group to generate their config files  
(this is just one example; different hosts have different dependencies).

So if i try

ansible-playbook -i inventory site.yml --limit nonzkhost

the run fails with:

fatal: [nonzkhost1] =\> {'msg': "One or more undefined variables: 'dict  
object' has no attribute 'ansible\_eth1'", 'failed': True}

To use the '--limit' flag, I have to remember to also list all  
zookeepers in a play.  
Similar issues happen with Ansibles 'retry' feature.

I think my issue is that I need actual facts gathered from those hosts  
rather than just their names (which are accessible in the inventory of course).

Is there a flag I can pass to get a full 'GATHER FACTS' pass before  
only running a play against selected nodes, or am I just Doing It Wrong here?

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [May 16, 2014, 11:19pm UTC](https://forum.ansible.com/t/ansible-playbook-limit-limitations/15254/2 "2014-05-16T23:19:59Z")

</div>

If you use limit it won’t gather facts from machines not in the limit group.

(There have been a few threads about this)

---

<div class="post-metadata">

**Author:** ![Dick\_Davies](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@Dick\_Davies](https://forum.ansible.com/u/Dick_Davies)\
**Post date:** [May 17, 2014, 11:32am UTC](https://forum.ansible.com/t/ansible-playbook-limit-limitations/15254/3 "2014-05-17T11:32:11Z")

</div>

Thanks Michael

Yeah so it seems - is that by design?

This can actually be dangerous (if for example all zookeepers aren't  
explicitly specified, configurations will drop some from the client configs  
and bounce services, potentially leading to cluster splits),  
would be good if there was some workaround.

Is there any way to make orchestration and limit play nicely together,  
or do you feel they're mutually exclusive?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [May 17, 2014, 3:27pm UTC](https://forum.ansible.com/t/ansible-playbook-limit-limitations/15254/4 "2014-05-17T15:27:49Z")

</div>

there are other ways to do this, but not with --limit

- hosts: all  
name: this just gathers facts

- hosts: “some\_group{{limit|default(‘’)}}”

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [May 19, 2014, 2:55am UTC](https://forum.ansible.com/t/ansible-playbook-limit-limitations/15254/5 "2014-05-19T02:55:00Z")

</div>

This.

---

<div class="post-metadata">

**Author:** ![Michael\_Peters](https://avatars.discourse-cdn.com/v4/letter/m/c2a13f/32.png) [@Michael\_Peters](https://forum.ansible.com/u/Michael_Peters)\
**Post date:** [May 19, 2014, 1:39pm UTC](https://forum.ansible.com/t/ansible-playbook-limit-limitations/15254/6 "2014-05-19T13:39:47Z")

</div>

I know I'm new here, but this has bitten me several times already. It  
seems that fact gathering of other hosts not in the play loop is such  
a common thing that there should be a more explicit way to do this  
besides just the side effect of a play with no tasks. Because you have  
to set things up to always have to pass an extra variable on the  
command line which increases the amount you need to memorize just to  
execute every play. And then if things change such that you need to  
include other groups in the task gathering that are not included in  
the execution you have to retrain everyone for every invocation that  
isn't global.

I appreciate that there is a work around for the general case, but  
fact gathering of other hosts seems like such a common thing that  
there should be a way to do it not as a side effect that needs  
invocation hurdles.

Just my 2¢

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [May 21, 2014, 9:47pm UTC](https://forum.ansible.com/t/ansible-playbook-limit-limitations/15254/7 "2014-05-21T21:47:40Z")

</div>

It’s a popular request.

We’re aware of it - but also chasing about 500 other things people want and have to balance these things 🙂

Stay tuned!
