mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
dont add all group vars to implicit on create
they already get added in vars manager on use. fixes #31420
This commit is contained in:
parent
90e8071d48
commit
383170e9e1
1 changed files with 9 additions and 14 deletions
|
@ -75,23 +75,18 @@ class InventoryData(object):
|
|||
else:
|
||||
new_host = Host(pattern)
|
||||
|
||||
# use 'all' vars but not part of all group
|
||||
new_host.vars = self.groups['all'].get_vars()
|
||||
|
||||
new_host.address = "127.0.0.1"
|
||||
new_host.implicit = True
|
||||
|
||||
if "ansible_python_interpreter" not in new_host.vars:
|
||||
py_interp = sys.executable
|
||||
if not py_interp:
|
||||
# sys.executable is not set in some cornercases. #13585
|
||||
py_interp = '/usr/bin/python'
|
||||
display.warning('Unable to determine python interpreter from sys.executable. Using /usr/bin/python default. '
|
||||
'You can correct this by setting ansible_python_interpreter for localhost')
|
||||
new_host.set_variable("ansible_python_interpreter", py_interp)
|
||||
|
||||
if "ansible_connection" not in new_host.vars:
|
||||
new_host.set_variable("ansible_connection", 'local')
|
||||
# set localhost defaults
|
||||
py_interp = sys.executable
|
||||
if not py_interp:
|
||||
# sys.executable is not set in some cornercases. see issue #13585
|
||||
py_interp = '/usr/bin/python'
|
||||
display.warning('Unable to determine python interpreter from sys.executable. Using /usr/bin/python default. '
|
||||
'You can correct this by setting ansible_python_interpreter for localhost')
|
||||
new_host.set_variable("ansible_python_interpreter", py_interp)
|
||||
new_host.set_variable("ansible_connection", 'local')
|
||||
|
||||
self.localhost = new_host
|
||||
|
||||
|
|
Loading…
Reference in a new issue