# Ansible - To limit the execution for the range of hosts

**URL:** <https://forum.ansible.com/t/ansible-to-limit-the-execution-for-the-range-of-hosts/30659>\
**Category:** Ansible Developer\
**Created:** [June 26, 2019, 11:10am UTC](https://forum.ansible.com/t/ansible-to-limit-the-execution-for-the-range-of-hosts/30659 "2019-06-26T11:10:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Preethi\_Muruganantha](https://avatars.discourse-cdn.com/v4/letter/p/df788c/32.png) [@Preethi\_Muruganantha](https://forum.ansible.com/u/Preethi_Muruganantha)\
**Post date:** [June 26, 2019, 11:10am UTC](https://forum.ansible.com/t/ansible-to-limit-the-execution-for-the-range-of-hosts/30659/1 "2019-06-26T11:10:17Z")

</div>

I need to limit the playbook execution for particular hosts.  
Eg., From host1 to the host mentioned in site.retry file

My inventory file:

192.168.11.1  
192.168.11.2  
192.168.11.3

Playbook name: site.yml  
Command: ansible-playbook site.yml --limit @~/site.retry)

The above command executes the playbook only for the host present in site.retry file.  
But I need to execute the playbook from host1 until the host present in site.retry file.

For eg., if site.retry file contains - 192.168.11.2  
I need the playbook to run for 192.168.11.1 and 192.168.11.2 (ie., from the host1 till the one mentioned in site.retry file)

Is there any way to achieve this?

Or is there any way in ansible to fetch the IP of the hosts where the playbooks are executed?  
As like .retry file in ansible which holds the IP of failed one/current execution, is there any ways in ansible which holds the IPs of all executed hosts alone(ie., hosts in which the playbook executes)
