mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Updated to support inventory options from command line
This commit is contained in:
parent
1ff93e6b08
commit
e0a15d0c50
1 changed files with 2 additions and 2 deletions
|
@ -34,12 +34,12 @@ class LookupModule(object):
|
||||||
|
|
||||||
def __init__(self, basedir=None, **kwargs):
|
def __init__(self, basedir=None, **kwargs):
|
||||||
self.basedir = basedir
|
self.basedir = basedir
|
||||||
|
self.host_list = kwargs['runner'].inventory.host_list
|
||||||
|
|
||||||
def run(self, terms, inject=None, **kwargs):
|
def run(self, terms, inject=None, **kwargs):
|
||||||
terms = utils.listify_lookup_plugin_terms(terms, self.basedir, inject)
|
terms = utils.listify_lookup_plugin_terms(terms, self.basedir, inject)
|
||||||
|
|
||||||
if not isinstance(terms, list):
|
if not isinstance(terms, list):
|
||||||
raise errors.AnsibleError("with_inventory_hostnames expects a list")
|
raise errors.AnsibleError("with_inventory_hostnames expects a list")
|
||||||
|
return flatten(inventory.Inventory(self.host_list).list_hosts(terms))
|
||||||
return flatten(inventory.Inventory().list_hosts(terms))
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue