mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
Use value of delegated transport for var lookup (#35658)
This commit is contained in:
@@ -331,7 +331,7 @@ class PlayContext(Base):
|
||||
# address, otherwise we default to connecting to it by name. This
|
||||
# may happen when users put an IP entry into their inventory, or if
|
||||
# they rely on DNS for a non-inventory hostname
|
||||
for address_var in ('ansible_%s_host' % transport_var,) + C.MAGIC_VARIABLE_MAPPING.get('remote_addr'):
|
||||
for address_var in ('ansible_%s_host' % delegated_transport,) + C.MAGIC_VARIABLE_MAPPING.get('remote_addr'):
|
||||
if address_var in delegated_vars:
|
||||
break
|
||||
else:
|
||||
@@ -340,7 +340,7 @@ class PlayContext(Base):
|
||||
|
||||
# reset the port back to the default if none was specified, to prevent
|
||||
# the delegated host from inheriting the original host's setting
|
||||
for port_var in ('ansible_%s_port' % transport_var,) + C.MAGIC_VARIABLE_MAPPING.get('port'):
|
||||
for port_var in ('ansible_%s_port' % delegated_transport,) + C.MAGIC_VARIABLE_MAPPING.get('port'):
|
||||
if port_var in delegated_vars:
|
||||
break
|
||||
else:
|
||||
@@ -350,7 +350,7 @@ class PlayContext(Base):
|
||||
delegated_vars['ansible_port'] = C.DEFAULT_REMOTE_PORT
|
||||
|
||||
# and likewise for the remote user
|
||||
for user_var in ('ansible_%s_user' % transport_var,) + C.MAGIC_VARIABLE_MAPPING.get('remote_user'):
|
||||
for user_var in ('ansible_%s_user' % delegated_transport,) + C.MAGIC_VARIABLE_MAPPING.get('remote_user'):
|
||||
if user_var in delegated_vars and delegated_vars[user_var]:
|
||||
break
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user