only set ansible_ssh_host if not already set

This commit is contained in:
Dann Bohn 2015-07-20 15:43:55 -04:00
parent 5347db2952
commit 3e79bfa2d6

View file

@ -121,7 +121,9 @@ class Host:
results = combine_vars(results, self.vars) results = combine_vars(results, self.vars)
results['inventory_hostname'] = self.name results['inventory_hostname'] = self.name
results['inventory_hostname_short'] = self.name.split('.')[0] results['inventory_hostname_short'] = self.name.split('.')[0]
results['ansible_ssh_host'] = self.ipv4_address
if 'ansible_ssh_host' not in results:
results['ansible_ssh_host'] = self.ipv4_address
if 'ansible_ssh_port' not in results: if 'ansible_ssh_port' not in results:
results['ansible_ssh_port'] = C.DEFAULT_REMOTE_PORT results['ansible_ssh_port'] = C.DEFAULT_REMOTE_PORT