Skip to content

Commit

Permalink
Load vars for localhost when created implicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
jimi-c committed Oct 8, 2015
1 parent 8f18e65 commit 5a0f5f1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/ansible/inventory/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,9 +421,11 @@ def __append_host_to_results(host):

def _create_implicit_localhost(self, pattern):
new_host = Host(pattern)
new_host.set_variable("ansible_python_interpreter", sys.executable)
new_host.address = "127.0.0.1"
new_host.vars = self.get_host_vars(new_host)
new_host.set_variable("ansible_connection", "local")
new_host.address = '127.0.0.1'
if "ansible_python_interpreter" not in new_host.vars:
new_host.set_variable("ansible_python_interpreter", sys.executable)
self.get_group("ungrouped").add_host(new_host)
return new_host

Expand Down

0 comments on commit 5a0f5f1

Please sign in to comment.