# implicit localhost and limit

**URL:** <https://forum.ansible.com/t/implicit-localhost-and-limit/15136>\
**Category:** Ansible Project\
**Created:** [May 1, 2014, 7:36pm UTC](https://forum.ansible.com/t/implicit-localhost-and-limit/15136 "2014-05-01T19:36:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jesse\_Keating](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@Jesse\_Keating](https://forum.ansible.com/u/Jesse_Keating)\
**Post date:** [May 1, 2014, 7:36pm UTC](https://forum.ansible.com/t/implicit-localhost-and-limit/15136/1 "2014-05-01T19:36:25Z")

</div>

So with 1.5 there is an implicit localhost, which means we don't have to have an explicit one in our inventory to do things like

hosts: localhost  
or  
local\_action: foo  
or  
delegate\_to: localhost

This is great, and awesome, and works fine, however I'm curious what the semantics are when --limit comes into play.

What happens when you encounter a play that has hosts: localhost , and your --limit does not include localhost? Should it run?

What about delegate\_to: localhost when your limit doesn't include localhost?

Taking a thought stab, I would expect that plays with hosts: localhost would skip with no matching host, but the delegation would work, because it would be operating in the host loop for a host you've included in your limit, even if the task is delegated out. This is how it would work with any other host.

Is my thinking correct here?

-jlk

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [May 1, 2014, 9:38pm UTC](https://forum.ansible.com/t/implicit-localhost-and-limit/15136/2 "2014-05-01T21:38:19Z")

</div>

So right now it’s pretty explicit, I believe, and if you say “don’t include localhost” it doesn’t.

Thus localhost isn’t implicit in the limit.

I can see it both ways.

In this case, I think I’d side on requiring limit to explicitly include localhost to avoid accidental self management in cases where a configuration might apply to many machines and somebody (against the norm) was running ansible on a machine that also expected to be managing that machine.

Thoughts?

I do think delegation should continue to work fine, as delegation has always worked outside of limits.
