From da44fb1e43cd845a6c03232d14b275a75e4f77e8 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Mon, 30 Jul 2012 19:26:46 -0400 Subject: [PATCH] Fixes #731 by reinstating variables for inventory scripts --- lib/ansible/inventory/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/ansible/inventory/__init__.py b/lib/ansible/inventory/__init__.py index eabf3684d1b..a23c85a6fd5 100644 --- a/lib/ansible/inventory/__init__.py +++ b/lib/ansible/inventory/__init__.py @@ -163,6 +163,13 @@ class Inventory(object): ) (out, err) = cmd.communicate() results = utils.parse_json(out) + + # FIXME: this is a bit redundant with host.py and should share code + results['inventory_hostname'] = hostname + results['inventory_hostname_short'] = hostname.split('.')[0] + 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)