mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix group_by: do not group a host for which a condition is false
This commit is contained in:
parent
44e391fd8b
commit
e7957b6d58
1 changed files with 5 additions and 1 deletions
|
@ -61,9 +61,13 @@ class ActionModule(object):
|
||||||
conds = self.runner.conditional
|
conds = self.runner.conditional
|
||||||
if type(conds) != list:
|
if type(conds) != list:
|
||||||
conds = [ conds ]
|
conds = [ conds ]
|
||||||
|
next_host = False
|
||||||
for cond in conds:
|
for cond in conds:
|
||||||
if not check_conditional(cond, self.runner.basedir, data, fail_on_undefined=self.runner.error_on_undefined_vars):
|
if not check_conditional(cond, self.runner.basedir, data, fail_on_undefined=self.runner.error_on_undefined_vars):
|
||||||
continue
|
next_host = True
|
||||||
|
break
|
||||||
|
if next_host:
|
||||||
|
continue
|
||||||
group_name = template.template(self.runner.basedir, args['key'], data)
|
group_name = template.template(self.runner.basedir, args['key'], data)
|
||||||
group_name = group_name.replace(' ','-')
|
group_name = group_name.replace(' ','-')
|
||||||
if group_name not in groups:
|
if group_name not in groups:
|
||||||
|
|
Loading…
Reference in a new issue