Skip to content

Commit 951a828

Browse files
nkakourosssbarnea
andauthored
Accept shell when executable is set (#2176)
Co-authored-by: Sorin Sbarnea <[email protected]>
1 parent e6126f2 commit 951a828

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/ansiblelint/rules/command_instead_of_shell.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,12 @@ def matchtask(
116116
# Use unjinja so that we don't match on jinja filters
117117
# rather than pipes
118118
if task["action"]["__ansible_module__"] in ["shell", "ansible.builtin.shell"]:
119+
# Since Ansible 2.4, the `command` module does not accept setting
120+
# the `executable`. If the user needs to set it, they have to use
121+
# the `shell` module.
122+
if "executable" in task["action"]:
123+
return False
124+
119125
if "cmd" in task["action"]:
120126
jinja_stripped_cmd = self.unjinja(task["action"].get("cmd", []))
121127
else:

0 commit comments

Comments
 (0)