# Inventory file and hosts: localhost

**URL:** <https://forum.ansible.com/t/inventory-file-and-hosts-localhost/20651>\
**Category:** Ansible Project\
**Created:** [February 23, 2016, 12:58am UTC](https://forum.ansible.com/t/inventory-file-and-hosts-localhost/20651 "2016-02-23T00:58:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Peter\_W](https://avatars.discourse-cdn.com/v4/letter/p/c89c15/32.png) [@Peter\_W](https://forum.ansible.com/u/Peter_W)\
**Post date:** [February 23, 2016, 12:58am UTC](https://forum.ansible.com/t/inventory-file-and-hosts-localhost/20651/1 "2016-02-23T00:58:52Z")

</div>

Hi,

I’m using ansible-1.9.4 (from CentOS7 distro) and also I’m new to the product.

I’m trying to come up with some form of bootstrapping after kickstart where ansible-pull will run a few tasks regardless of the hostname.

Seems that ‘hosts: localhost’ should do the right thing but I’m running in the following issues:

- If the hosts file has no entry for the new system  
The ansible-pull will fail.

- If the hosts file is empty  
The ansible-pull will properly process 'hosts: localhost" play.

- If the hosts file doesn’t exists  
The ansible-pull will fail.

The only way to make “hosts: localhost” work is to empty the hosts file.

Is that the expected behavior or I’m missing some configuration?

Thank you,

– Peter
