title: How to add variables with command line in ansible?
body: <p>i have to playbook for tower-cli command, which will create credentials with custom credentials type.</p>
  <pre><code>     - name: Create a valid SCM credential from a private_key file
     shell:
       cmd: tower-cli credential create --organization &quot;Default&quot; --name &quot;DevOps User&quot; --credential-type &quot;csa-test2&quot; --inputs &quot;{'user':'devops','stg01_ssh_key':\&quot;$( sed -z 's/\n/\\n/g' test.pem )\&quot;}&quot;
     no_log: false
  </code></pre>
  <p>This code is working prefectly, ssh file is aligned in the correct format.</p>
  <p>As my code is quite messy, i added the sed command as variable, and passed that variable to cmd module like below.</p>
  <pre><code>---
  - name: Trigger an Atower API
    hosts: localhost
    connection: local
    vars:
       keyy: $( sed -z 's/^//' test.pem )
  
    tasks:
       - name: Create a valid SCM credential from a private_key file
         shell:
           cmd: tower-cli credential create --organization &quot;Default&quot; --name &quot;DevOps User&quot; --credential-type &quot;csa-test2&quot; --inputs &quot;{'user':'devops','stg01_ssh_key':'{{ keyy }}'}&quot;
         no_log: false
  </code></pre>
  <p>SSH file is not aligned like before input. To do this alignment i have used the sed command. What I am doing wrong here?</p>