From 547395a2be5b462f3c659d0a2ae5b85dc35e7ea8 Mon Sep 17 00:00:00 2001 From: Derek Carter Date: Mon, 30 Jul 2012 13:26:48 -0400 Subject: [PATCH] added inventory_hostname_short varible --- lib/ansible/inventory/__init__.py | 3 --- lib/ansible/inventory/host.py | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/ansible/inventory/__init__.py b/lib/ansible/inventory/__init__.py index ca6da1a1f8..0de98b0fe6 100644 --- a/lib/ansible/inventory/__init__.py +++ b/lib/ansible/inventory/__init__.py @@ -163,9 +163,6 @@ class Inventory(object): ) (out, err) = cmd.communicate() 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 host = self.get_host(hostname) diff --git a/lib/ansible/inventory/host.py b/lib/ansible/inventory/host.py index c96a5cb0ce..56e4e756d1 100644 --- a/lib/ansible/inventory/host.py +++ b/lib/ansible/inventory/host.py @@ -59,6 +59,7 @@ class Host(object): results.update(group.get_variables()) results.update(self.vars) results['inventory_hostname'] = self.name + results['inventory_hostname_short'] = self.name.split('.')[0] groups = self.get_groups() results['group_names'] = sorted([ g.name for g in groups if g.name != 'all']) return results