Repository: ansible/ansible-lint

Issue:
False positive EANSIBLE0014 also flags vars in shell task
# Issue Type
- Bug report

# Ansible and Ansible Lint details
```
ansible --version
ansible 2.3.0.0
ansible-lint --version
ansible-lint 3.4.13
```

- ansible installation method: pip
- ansible-lint installation method: pip

# Desired Behaviour

EANSIBLE0014 should validate only command task, not shell.

# Actual Behaviour (Bug report only)

When ansible-lint validating playbook with shell tasks with env vars
```
- hosts: "localhost"
  gather_facts: no
  become: no
  tasks:
      - shell: 'MYVAR="$(date)" env | grep MY'
```
it fails and complains about Env vars shouldn't be in command
```
test-play.yaml:5: [EANSIBLE0014] Environment variables don't work as part of command
```



Discussion:
What makes these bugs even worse is that there is no way to disable a specific check per command. `ansible_skip_lint` is like using shotgun for kill a fly as it disables all checks.
What might be the status of this? I think i can put something into my ignore for this line but i would rather it be fixed... 
When I originally created EANSIBLE0014, I'm sure that using shell vars in the command didn't really work (maybe I have that wrong). Even now, I'm not hugely convinced by the use case - I prefer the use of `environment`. Ignoring the obvious ways to ansibilise the above command (I'll assume `date` is just an example), it could still be done with registering the results of a command and using that with `environment` in a subsequent command. 

If you want to ignore issues with `command` or `shell`, you can just set the `warn=no` parameter - ansible-lint respects that (or at least it does for certain checks - that would be a different bug though if EANSIBLE0014 doesn't respect `warn`)
It seems that `warn: no` does not make ansible-lint ignore variable assignment on shell/command modules

```
- name: Test
  host: localhost
  gather_facts: False
  tasks:
    - name: A
      command: |
        a=10
      changed_when: false
      args:
        warn: no
```
```
[ANSIBLE0014] Environment variables don't work as part of command
test.yml:5
Task/Handler: A
```

The workaround for me is to actually put a comment as the first statement on shell/command modules. Then ansible-lint is happy
I am looking forward to see this fixed.

Resolving patch:
diff --git a/lib/ansiblelint/rules/EnvVarsInCommandRule.py b/lib/ansiblelint/rules/EnvVarsInCommandRule.py
--- a/lib/ansiblelint/rules/EnvVarsInCommandRule.py
+++ b/lib/ansiblelint/rules/EnvVarsInCommandRule.py
@@ -38,7 +38,7 @@ class EnvVarsInCommandRule(AnsibleLintRule):
                      LINE_NUMBER_KEY, FILENAME_KEY]
 
     def matchtask(self, file, task):
-        if task["action"]["__ansible_module__"] in ['shell', 'command']:
+        if task["action"]["__ansible_module__"] in ['command']:
             first_cmd_arg = get_first_cmd_arg(task)
             if not first_cmd_arg:
                 return


Test patch:
diff --git a/test/TestEnvVarsInCommand.py b/test/TestEnvVarsInCommand.py
--- a/test/TestEnvVarsInCommand.py
+++ b/test/TestEnvVarsInCommand.py
@@ -46,14 +46,17 @@
       argv:
         - echo
         - testing
+
+  - name: environment variable with shell
+    shell: HELLO=hello echo $HELLO
 '''
 
 FAIL_PLAY_TASKS = '''
 - hosts: localhost
 
   tasks:
-  - name: this doesn't work as it appears
-    shell: HELLO=hello echo $HELLO
+  - name: environment variable with command
+    command: HELLO=hello echo $HELLO
 
   - name: typo some stuff
     command: cerates=/tmp/blah warn=no touch /tmp/blah