mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
updated connection info update_vars to only update if data is not alreayd present
aslo added comment clarifying why we do this
This commit is contained in:
parent
956937b110
commit
872448e9e8
1 changed files with 8 additions and 7 deletions
|
@ -370,11 +370,12 @@ class ConnectionInformation:
|
|||
def update_vars(self, variables):
|
||||
'''
|
||||
Adds 'magic' variables relating to connections to the variable dictionary provided.
|
||||
In case users need to access from the play, this is a legacy from runner.
|
||||
'''
|
||||
#FIXME: is this reversed? why use this and not set_task_and_host_override?
|
||||
variables['ansible_connection'] = self.connection
|
||||
variables['ansible_ssh_host'] = self.remote_addr
|
||||
variables['ansible_ssh_pass'] = self.password
|
||||
variables['ansible_ssh_port'] = self.port
|
||||
variables['ansible_ssh_user'] = self.remote_user
|
||||
variables['ansible_ssh_private_key_file'] = self.private_key_file
|
||||
|
||||
#FIXME: remove password? possibly add become/sudo settings
|
||||
for special_var in ['ansible_connection', 'ansible_ssh_host', 'ansible_ssh_pass', 'ansible_ssh_port', 'ansible_ssh_user', 'ansible_ssh_private_key_file']:
|
||||
if special_var not in variables:
|
||||
for prop, varnames in MAGIC_VARIABLE_MAPPING.items():
|
||||
if special_var in varnames:
|
||||
variables[special_var] = getattr(self, prop)
|
||||
|
|
Loading…
Reference in a new issue