Commit 547395a2 by Derek Carter

added inventory_hostname_short varible

parent 8f9e136c
...@@ -163,9 +163,6 @@ class Inventory(object): ...@@ -163,9 +163,6 @@ class Inventory(object):
) )
(out, err) = cmd.communicate() (out, err) = cmd.communicate()
results = utils.parse_json(out) results = utils.parse_json(out)
results['inventory_hostname'] = hostname
groups = [ g.name for g in host.get_groups() if g.name != 'all' ]
results['group_names'] = sorted(groups)
return results return results
host = self.get_host(hostname) host = self.get_host(hostname)
......
...@@ -59,6 +59,7 @@ class Host(object): ...@@ -59,6 +59,7 @@ class Host(object):
results.update(group.get_variables()) results.update(group.get_variables())
results.update(self.vars) results.update(self.vars)
results['inventory_hostname'] = self.name results['inventory_hostname'] = self.name
results['inventory_hostname_short'] = self.name.split('.')[0]
groups = self.get_groups() groups = self.get_groups()
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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment