# dynamic inventory with host files

**URL:** <https://forum.ansible.com/t/dynamic-inventory-with-host-files/19372>\
**Category:** Ansible Project\
**Created:** [September 28, 2015, 10:00pm UTC](https://forum.ansible.com/t/dynamic-inventory-with-host-files/19372 "2015-09-28T22:00:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roy](https://avatars.discourse-cdn.com/v4/letter/r/4da419/32.png) [@Roy](https://forum.ansible.com/u/Roy)\
**Post date:** [September 28, 2015, 10:00pm UTC](https://forum.ansible.com/t/dynamic-inventory-with-host-files/19372/1 "2015-09-28T22:00:47Z")

</div>

Hi,

We have a use case in which I want to run playbook on specific set of machines and same task on spot instances which belongs to same set of machines but we dont have entry into host file.

We have cluster of machines (on demand) and some spot instances. I want to deploy code to all these machines (on demand + spot instances). So when we deploy code we want to deploy to all machines in one playbook run.

I am using python script to get the public ip of those spot instances.

I am looking a way to run playbook on on demand instances and one additional task inside the playbook which will call same playbook

role/hadoop/task/release.yml

> * * *
> 
> - name: check out project from github
> 
> git: \>  
> [repo=git@github.com](mailto:repo=git@github.com):Abc/abc.git  
> version=master  
> dest=/srv/jobs-prod/abc\_hadoop/  
> force=yes  
> key\_file=/root/.ssh/{{ GIT\_PRIVATE\_KEY }}  
> register: git\_checkout  
> when: branch == master and branch is defined  
> run\_once: True  
> serial: 4  
> tags:
> 
> - git\_tag

Then I have playbook as following

> # Fetches up to date remote branch to local machine

> tasks:

> # This task runs on inventry list provided
> 
> - include: role/hadoop/task/release.yml

After this first task is done I want to run same play on spot instance as second task in the same playbook. Is there any way to do this ?
