From 095ec760ac0b9706e82e0e825568656b22294742 Mon Sep 17 00:00:00 2001 From: James Tanner Date: Tue, 19 Apr 2016 22:41:46 -0400 Subject: [PATCH] Provide a warning if the play or the task attempts to pass environment to the raw module. Addresses ansible-modules-core/issues/32 --- lib/ansible/plugins/action/raw.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/ansible/plugins/action/raw.py b/lib/ansible/plugins/action/raw.py index a76e6d6c3c2..4774b3ade59 100644 --- a/lib/ansible/plugins/action/raw.py +++ b/lib/ansible/plugins/action/raw.py @@ -26,6 +26,11 @@ class ActionModule(ActionBase): def run(self, tmp=None, task_vars=None): if task_vars is None: task_vars = dict() + else: + if 'vars' in task_vars: + if 'environment' in task_vars['vars']: + # The environment key only exists if explicitly declared in the task or in the play + self._display.warning('raw module does not support the environment keyword') result = super(ActionModule, self).run(tmp, task_vars)