Using inventory shortcut -i "host," on ansible 1.5

Hi,

I guess it has something to do with new localhost feature of ansible 1.5

In playbook with
hosts: localhost:host

if i specify -i “host,” the play will be done for both localhost and host

GATHERING FACTS ***************************************************************
ok: [localhost]
ok: [oracle]

Is there any workaround for this situation?

So in Ansible now, localhost is implicitly added to inventory. This means you can reference it and it will work.

Now “-i host,” is an ugly vestigial tail of Ansible, and I swear I want to cut it off, but I’m not willing to deal with the people that have come to rely on it being angry :slight_smile:

We strongly encourage making inventory files and people should make inventory files.

That being said, what you have above works exactly the same as if you did

[foo]
host

and did the same with regular Ansible, that was just my PSA about the evils of “-i host,” and this not being specific to that :slight_smile:

So yes, this works exactly as it should.

You should defintely move to using inventory files, but “–limit hosts” should not include localhost in the above case.