mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix template call in group_by module.
This commit is contained in:
parent
a0a2ef3d9d
commit
a6777f7e7c
1 changed files with 4 additions and 3 deletions
|
@ -20,7 +20,8 @@ import ansible
|
||||||
from ansible.callbacks import vv
|
from ansible.callbacks import vv
|
||||||
from ansible.errors import AnsibleError as ae
|
from ansible.errors import AnsibleError as ae
|
||||||
from ansible.runner.return_data import ReturnData
|
from ansible.runner.return_data import ReturnData
|
||||||
from ansible.utils import parse_kv, template, check_conditional
|
from ansible.utils import parse_kv, check_conditional
|
||||||
|
import ansible.utils.template as template
|
||||||
|
|
||||||
class ActionModule(object):
|
class ActionModule(object):
|
||||||
''' Create inventory groups based on variables '''
|
''' Create inventory groups based on variables '''
|
||||||
|
@ -54,9 +55,9 @@ class ActionModule(object):
|
||||||
groups = {}
|
groups = {}
|
||||||
for host in self.runner.host_set:
|
for host in self.runner.host_set:
|
||||||
data = inject['hostvars'][host]
|
data = inject['hostvars'][host]
|
||||||
if not check_conditional(template(self.runner.basedir, self.runner.conditional, data)):
|
if not check_conditional(template.template(self.runner.basedir, self.runner.conditional, data)):
|
||||||
continue
|
continue
|
||||||
group_name = 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:
|
||||||
groups[group_name] = []
|
groups[group_name] = []
|
||||||
|
|
Loading…
Reference in a new issue