Inventory file and hosts: localhost

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