# Limiting hosts when including playbooks stopped working in 1.8

**URL:** <https://forum.ansible.com/t/limiting-hosts-when-including-playbooks-stopped-working-in-1-8/16958>\
**Category:** Ansible Project\
**Created:** [December 4, 2014, 9:40am UTC](https://forum.ansible.com/t/limiting-hosts-when-including-playbooks-stopped-working-in-1-8/16958 "2014-12-04T09:40:15Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wolfgang\_Ziegler](https://avatars.discourse-cdn.com/v4/letter/w/a8b319/32.png) [@Wolfgang\_Ziegler](https://forum.ansible.com/u/Wolfgang_Ziegler)\
**Post date:** [December 4, 2014, 9:40am UTC](https://forum.ansible.com/t/limiting-hosts-when-including-playbooks-stopped-working-in-1-8/16958/1 "2014-12-04T09:40:15Z")

</div>

Hi!

I’m using the pattern outlined at [https://github.com/ansible/ansible/pull/1956](https://github.com/ansible/ansible/pull/1956) to include playbooks for a limitted group of hosts. In short:

`

---

<div class="post-metadata">

**Author:** ![Wolfgang\_Ziegler](https://avatars.discourse-cdn.com/v4/letter/w/a8b319/32.png) [@Wolfgang\_Ziegler](https://forum.ansible.com/u/Wolfgang_Ziegler)\
**Post date:** [December 4, 2014, 10:10am UTC](https://forum.ansible.com/t/limiting-hosts-when-including-playbooks-stopped-working-in-1-8/16958/2 "2014-12-04T10:10:04Z")

</div>

I figured, the variabel replacement still works fine - but for some reason the host groups are not forwarded to the included playbook anymore. E.g., in root playbook the host is in group “mygroup”, but when the included playbook runs for “mygroup” the host is not matched any more. The output is like this:

PLAY [“mygroup”] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
skipping: no hosts matched

---

<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:** [December 5, 2014, 12:56am UTC](https://forum.ansible.com/t/limiting-hosts-when-including-playbooks-stopped-working-in-1-8/16958/3 "2014-12-05T00:56:22Z")

</div>

Ansible hasn’t used a dollar sign for variable replacement in a long time

Try

{{ hosts }}

---

<div class="post-metadata">

**Author:** ![Wolfgang\_Ziegler](https://avatars.discourse-cdn.com/v4/letter/w/a8b319/32.png) [@Wolfgang\_Ziegler](https://forum.ansible.com/u/Wolfgang_Ziegler)\
**Post date:** [December 5, 2014, 10:48pm UTC](https://forum.ansible.com/t/limiting-hosts-when-including-playbooks-stopped-working-in-1-8/16958/4 "2014-12-05T22:48:17Z")

</div>

Sure, I’ve been using {{ hosts }} - I just copied the example from the old docs - sry for that. I did some more testing and think this is a bug. I reported it with a simple example playbook at [https://github.com/ansible/ansible/issues/9733](https://github.com/ansible/ansible/issues/9733)

---

<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:** [December 6, 2014, 4:50am UTC](https://forum.ansible.com/t/limiting-hosts-when-including-playbooks-stopped-working-in-1-8/16958/5 "2014-12-06T04:50:11Z")

</div>

Where did you define the ‘my group’ variable?

---

<div class="post-metadata">

**Author:** ![Wolfgang\_Ziegler](https://avatars.discourse-cdn.com/v4/letter/w/a8b319/32.png) [@Wolfgang\_Ziegler](https://forum.ansible.com/u/Wolfgang_Ziegler)\
**Post date:** [December 7, 2014, 7:32pm UTC](https://forum.ansible.com/t/limiting-hosts-when-including-playbooks-stopped-working-in-1-8/16958/6 "2014-12-07T19:32:20Z")

</div>

As noted in the example over at [https://github.com/ansible/ansible/issues/9733](https://github.com/ansible/ansible/issues/9733) I’m setting the host-group when including the playbook like this:

```auto

- include: test-include.yml hosts="group"

```

---

<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:** [December 7, 2014, 9:37pm UTC](https://forum.ansible.com/t/limiting-hosts-when-including-playbooks-stopped-working-in-1-8/16958/7 "2014-12-07T21:37:20Z")

</div>

Yeah the scope is wrong on this one - You can’t do that.

If it happened to work like this before, it would be an accident 🙂

---

<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:** [December 7, 2014, 9:38pm UTC](https://forum.ansible.com/t/limiting-hosts-when-including-playbooks-stopped-working-in-1-8/16958/8 "2014-12-07T21:38:13Z")

</div>

Perhaps you meant this was a playbook level include – which perhaps should.

Can we see the top level playbook in entirety?

---

<div class="post-metadata">

**Author:** ![Wolfgang\_Ziegler](https://avatars.discourse-cdn.com/v4/letter/w/a8b319/32.png) [@Wolfgang\_Ziegler](https://forum.ansible.com/u/Wolfgang_Ziegler)\
**Post date:** [December 16, 2014, 8:53pm UTC](https://forum.ansible.com/t/limiting-hosts-when-including-playbooks-stopped-working-in-1-8/16958/9 "2014-12-16T20:53:29Z")

</div>

Yes, it’s a playbook level include. It looks like the following:

`
