Further cleanup of internal use of ansible_ssh_host
This commit is contained in:
parent
ee835ff7ad
commit
49a6601856
2 changed files with 3 additions and 10 deletions
|
@ -121,13 +121,6 @@ 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]
|
||||||
|
|
||||||
if 'ansible_ssh_host' not in results:
|
|
||||||
results['ansible_ssh_host'] = self.ipv4_address
|
|
||||||
|
|
||||||
if 'ansible_ssh_port' not in results:
|
|
||||||
results['ansible_ssh_port'] = C.DEFAULT_REMOTE_PORT
|
|
||||||
|
|
||||||
results['group_names'] = sorted([ g.name for g in groups if g.name != 'all'])
|
results['group_names'] = sorted([ g.name for g in groups if g.name != 'all'])
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
|
@ -146,10 +146,10 @@ class InventoryParser(object):
|
||||||
(k,v) = t.split("=", 1)
|
(k,v) = t.split("=", 1)
|
||||||
except ValueError, e:
|
except ValueError, e:
|
||||||
raise AnsibleError("Invalid ini entry in %s: %s - %s" % (self.filename, t, str(e)))
|
raise AnsibleError("Invalid ini entry in %s: %s - %s" % (self.filename, t, str(e)))
|
||||||
|
v = self._parse_value(v)
|
||||||
if k == 'ansible_ssh_host':
|
if k == 'ansible_ssh_host':
|
||||||
host.ipv4_address = self._parse_value(v)
|
host.ipv4_address = v
|
||||||
else:
|
host.set_variable(k, v)
|
||||||
host.set_variable(k, self._parse_value(v))
|
|
||||||
self.groups[active_group_name].add_host(host)
|
self.groups[active_group_name].add_host(host)
|
||||||
|
|
||||||
# [southeast:children]
|
# [southeast:children]
|
||||||
|
|
Loading…
Add table
Reference in a new issue