diff --git a/lib/ansible/plugins/action/package.py b/lib/ansible/plugins/action/package.py index d3062866d4..c93fa311c1 100644 --- a/lib/ansible/plugins/action/package.py +++ b/lib/ansible/plugins/action/package.py @@ -46,9 +46,9 @@ class ActionModule(ActionBase): if module == 'auto': try: if self._task.delegate_to: # if we delegate, we should use delegated host's facts - module = self._templar.template("{{hostvars['%s']['ansible_pkg_mgr']}}" % self._task.delegate_to) + module = self._templar.template("{{hostvars['%s']['ansible_facts']['ansible_pkg_mgr']}}" % self._task.delegate_to) else: - module = self._templar.template('{{ansible_pkg_mgr}}') + module = self._templar.template('{{ansible_facts["ansible_pkg_mgr"]}}') except: pass # could not get it from template! diff --git a/lib/ansible/plugins/action/service.py b/lib/ansible/plugins/action/service.py index dd521e1b67..37539d6cea 100644 --- a/lib/ansible/plugins/action/service.py +++ b/lib/ansible/plugins/action/service.py @@ -45,9 +45,9 @@ class ActionModule(ActionBase): if module == 'auto': try: if self._task.delegate_to: # if we delegate, we should use delegated host's facts - module = self._templar.template("{{hostvars['%s']['ansible_service_mgr']}}" % self._task.delegate_to) + module = self._templar.template("{{hostvars['%s']['ansible_facts']['ansible_service_mgr']}}" % self._task.delegate_to) else: - module = self._templar.template('{{ansible_service_mgr}}') + module = self._templar.template('{{ansible_facts["ansible_service_mgr"]}}') except: pass # could not get it from template!