title: Delete if exists not working from ansible playbook
body: <p>I am new to Ansible and facing the following issue in one of my playbooks</p>
  
  <p>Ansible playbook task code:</p>
  
  <pre><code>- name: Delete existing dist folder
    shell: "[ -d {{ base_path }}/dist ] &amp;&amp; rm -rf {{ base_path }}/dist"
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>fatal: [masked.amazonaws.com]: FAILED! =&gt; {
  "changed": true,
  "cmd": "[ -d /home/centos/masked/masked/dist ] &amp;&amp; rm -rf /home/centos/masked/masked/dist",
  "delta": "0:00:00.098034",
  "end": "2018-09-26 20:26:06.940872",
  "invocation": {
      "module_args": {
          "_raw_params": "[ -d /home/centos/masked/masked/dist ] &amp;&amp; rm -rf /home/centos/masked/masked/dist",
          "_uses_shell": true,
          "argv": null,
          "chdir": null,
          "creates": null,
          "executable": null,
          "removes": null,
          "stdin": null,
          "warn": true
      }
  },
  "msg": "non-zero return code",
  "rc": 1,
  "start": "2018-09-26 20:26:06.842838",
  "stderr": "",
  "stderr_lines": [],
  "stdout": "",
  "stdout_lines": []
  </code></pre>
  
  <p>If I run this command manually, it works just fine</p>
  
  <pre><code>[ -d /home/centos/masked/masked/dist ] &amp;&amp; rm -rf 
  /home/centos/masked/masked/dist
  </code></pre>
  
  <p>Does anyone have any idea what could be wrong?</p>
  
  <p>Appreciate your responses.</p>
  
  <p>Thanks in advance.</p>