fixed service fact usage
This commit is contained in:
parent
329c62e914
commit
6a0a366746
1 changed files with 3 additions and 3 deletions
|
@ -32,7 +32,7 @@ class ActionModule(ActionBase):
|
|||
|
||||
result = super(ActionModule, self).run(tmp, task_vars)
|
||||
|
||||
module = self._task.args.get('use', 'auto')
|
||||
module = self._task.args.get('use', 'auto').lower()
|
||||
|
||||
if module == 'auto':
|
||||
try:
|
||||
|
@ -43,8 +43,8 @@ class ActionModule(ActionBase):
|
|||
if module == 'auto':
|
||||
facts = self._execute_module(module_name='setup', module_args=dict(gather_subset='!all', filter='ansible_service_mgr'), task_vars=task_vars)
|
||||
self._display.debug("Facts %s" % facts)
|
||||
if 'failed' not in facts:
|
||||
module = getattr(facts['ansible_facts'], 'ansible_service_mgr', 'auto')
|
||||
if 'ansible_facts' in facts and 'ansible_service_mgr' in facts['ansible_facts']:
|
||||
module = facts['ansible_facts']['ansible_service_mgr']
|
||||
|
||||
if not module or module == 'auto' or module not in self._shared_loader_obj.module_loader:
|
||||
module = 'service'
|
||||
|
|
Loading…
Reference in a new issue