mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
corrected host/group match in inventory_hostnames
now the lookup works when using ! and & operators fixes #13997
This commit is contained in:
parent
9b05a670c7
commit
c2ac1507ea
1 changed files with 9 additions and 4 deletions
|
@ -26,10 +26,15 @@ class LookupModule(LookupBase):
|
||||||
|
|
||||||
def get_hosts(self, variables, pattern):
|
def get_hosts(self, variables, pattern):
|
||||||
hosts = []
|
hosts = []
|
||||||
if pattern in variables['groups']:
|
if pattern[0] in ('!','&'):
|
||||||
hosts = variables['groups'][pattern]
|
obj = pattern[1:]
|
||||||
elif pattern in variables['groups']['all']:
|
else:
|
||||||
hosts = [pattern]
|
obj = pattern
|
||||||
|
|
||||||
|
if obj in variables['groups']:
|
||||||
|
hosts = variables['groups'][obj]
|
||||||
|
elif obj in variables['groups']['all']:
|
||||||
|
hosts = [obj]
|
||||||
return hosts
|
return hosts
|
||||||
|
|
||||||
def run(self, terms, variables=None, **kwargs):
|
def run(self, terms, variables=None, **kwargs):
|
||||||
|
|
Loading…
Reference in a new issue