# Includes with limits and tags?

**URL:** <https://forum.ansible.com/t/includes-with-limits-and-tags/23877>\
**Category:** Ansible Project\
**Created:** [March 3, 2017, 4:06pm UTC](https://forum.ansible.com/t/includes-with-limits-and-tags/23877 "2017-03-03T16:06:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Josh\_Smift1](https://avatars.discourse-cdn.com/v4/letter/j/bcef8e/32.png) [@Josh\_Smift1](https://forum.ansible.com/u/Josh_Smift1)\
**Post date:** [March 3, 2017, 4:06pm UTC](https://forum.ansible.com/t/includes-with-limits-and-tags/23877/1 "2017-03-03T16:06:10Z")

</div>

We have a playbook that restores some data from a backup to a host, and  
afterwards we want to run another playbook that fixes up some things in  
the backup, but that other playbook is more general, and does a whole  
bunch of tasks, and affects all the hosts of this type. We'd rather only  
run the tasks that we know we need to run (which are identified by a tag),  
and only run them on the host they need to run on. Something like

- include: hosttype.yml  
&nbsp;&nbsp;limit: "{{ restorehost }}"  
&nbsp;&nbsp;tags: mytags

That actual code doesn't actually work, obviously.

Is there a way to do this within Ansible?

(We can do it by hand, obviously, but the restore playbook takes a long  
time, and someone has to then remember to come along and run hosttype.yml  
one when the restore is done. We could create a two-line shell script that  
run both playbooks, but it'd be cool to just be able to do this with an  
include.)

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-Josh (jbs@care.com)

(apologies for the automatic corporate disclaimer that follows)

This email is intended for the person(s) to whom it is addressed and may contain information that is PRIVILEGED or CONFIDENTIAL. Any unauthorized use, distribution, copying, or disclosure by any person other than the addressee(s) is strictly prohibited. If you have received this email in error, please notify the sender immediately by return email and delete the message and any attachments from your system.

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [March 3, 2017, 4:21pm UTC](https://forum.ansible.com/t/includes-with-limits-and-tags/23877/2 "2017-03-03T16:21:44Z")

</div>

You could do something like this if you are using ssh keys for login.  
- command: ansible-playbook hosttype.yml -l {{ restorehost }} -t mytags

---

<div class="post-metadata">

**Author:** ![Stankovic\_Marko](https://avatars.discourse-cdn.com/v4/letter/s/e495f1/32.png) [@Stankovic\_Marko](https://forum.ansible.com/u/Stankovic_Marko)\
**Post date:** [March 3, 2017, 4:34pm UTC](https://forum.ansible.com/t/includes-with-limits-and-tags/23877/3 "2017-03-03T16:34:55Z")

</div>

There's this feature request related to your question:  
[https://github.com/ansible/ansible/issues/14117](https://github.com/ansible/ansible/issues/14117)

Cheers,  
Marko  
CONFIDENTIALITY NOTICE: This message is the property of International Game Technology PLC and/or its subsidiaries and may contain proprietary, confidential or trade secret information. This message is intended solely for the use of the addressee. If you are not the intended recipient and have received this message in error, please delete this message from your system. Any unauthorized reading, distribution, copying, or other use of this message or its attachments is strictly prohibited.
