updated connection info update_vars to only update if data is not alreayd present

aslo added comment clarifying why we do this
pull/11259/merge
Brian Coca 9 years ago
parent 956937b110
commit 872448e9e8

@ -370,11 +370,12 @@ class ConnectionInformation:
def update_vars(self, variables): def update_vars(self, variables):
''' '''
Adds 'magic' variables relating to connections to the variable dictionary provided. 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 #FIXME: remove password? possibly add become/sudo settings
variables['ansible_ssh_host'] = self.remote_addr for special_var in ['ansible_connection', 'ansible_ssh_host', 'ansible_ssh_pass', 'ansible_ssh_port', 'ansible_ssh_user', 'ansible_ssh_private_key_file']:
variables['ansible_ssh_pass'] = self.password if special_var not in variables:
variables['ansible_ssh_port'] = self.port for prop, varnames in MAGIC_VARIABLE_MAPPING.items():
variables['ansible_ssh_user'] = self.remote_user if special_var in varnames:
variables['ansible_ssh_private_key_file'] = self.private_key_file variables[special_var] = getattr(self, prop)

Loading…
Cancel
Save