title: s there any way I can tell Ansible to execute the command exactly as I have given?
body: <p>I have a simple command with grep and perl regex to extract <code>catalina.home</code> from <code>ps -ef | grep java</code> output, as below.</p>
  <pre><code>ps -ef |grep java |grep -Po &quot;Dcatalina.home=[^\s]*\s&quot;
  </code></pre>
  <p>And when I execute this command it will extract only cataline.home part from the output as below.</p>
  <pre><code># ps -ef |grep java |grep -Po &quot;Dcatalina.home=[^\s]*\s&quot;
  Dcatalina.home=/usr/share/apache-tomcat-7.0.32
  </code></pre>
  <p>But when I issue the same command via Ansible, its sending to server as
  <code>ps -ef |grep java |grep -Po /\&quot;Dcatalina.home=[^/\\s]*\/\s\&quot;</code> and gives no output.</p>
  <p>Error from Ansible</p>
  <pre><code>FAILED! =&gt; {&quot;changed&quot;: true, &quot;cmd&quot;: &quot;cd $(ps -ef |grep java |grep -Po \&quot;Dcatalina.home=[^\\s]*\\s\&quot; | awk -F'=' '{print $2}') ; bash bin/version.sh | grep 'Server version:'&quot;, &quot;delta&quot;: &quot;0:00:00.080606&quot;, &quot;end&quot;: &quot;2017-08-17 03:57:02.816848&quot;, &quot;failed&quot;: true, &quot;rc&quot;: 1, &quot;start&quot;: &quot;2017-08-17 03:57:02.736242&quot;, &quot;stderr&quot;: &quot;/bin/sh: line 0: cd: [^\\s]*\\s\&quot;: No such file or directory\nbash: bin/version.sh: No such file or directory&quot;, &quot;stderr_lines&quot;: [&quot;/bin/sh: line 0: cd: [^\\s]*\\s\&quot;: No such file or directory&quot;, &quot;bash: bin/version.sh: No such file or directory&quot;], &quot;stdout&quot;: &quot;&quot;, &quot;stdout_lines&quot;: []}
  </code></pre>
  <p>Is there any way I can tell Ansible to execute the command exactly as I have given?</p>