From 012428e6bccd562b8ecff3c21a42d4a3b15e53b3 Mon Sep 17 00:00:00 2001 From: Matt Woodson Date: Mon, 15 Feb 2016 16:09:08 -0500 Subject: oo_filter: added custom fitler to return hosts group info --- filter_plugins/oo_filters.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'filter_plugins') diff --git a/filter_plugins/oo_filters.py b/filter_plugins/oo_filters.py index dcda14c63..3dc3f2fe9 100644 --- a/filter_plugins/oo_filters.py +++ b/filter_plugins/oo_filters.py @@ -697,6 +697,19 @@ class FilterModule(object): return matching_pods + @staticmethod + def oo_get_hosts_from_hostvars(hostvars, hosts): + """ Return a list of hosts from hostvars """ + retval = [] + for host in hosts: + try: + retval.append(hostvars[host]) + except errors.AnsibleError as _: + # host does not exist + pass + + return retval + def filters(self): """ returns a mapping of filters to methods """ return { @@ -724,4 +737,5 @@ class FilterModule(object): "oo_persistent_volume_claims": self.oo_persistent_volume_claims, "oo_31_rpm_rename_conversion": self.oo_31_rpm_rename_conversion, "oo_pods_match_component": self.oo_pods_match_component, + "oo_get_hosts_from_hostvars": self.oo_get_hosts_from_hostvars, } -- cgit v1.2.1