# passing command line arguments

**URL:** <https://forum.ansible.com/t/passing-command-line-arguments/26838>\
**Category:** Ansible Project\
**Tags:** ansible-project\
**Created:** [February 23, 2018, 2:43pm UTC](https://forum.ansible.com/t/passing-command-line-arguments/26838 "2018-02-23T14:43:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [February 23, 2018, 2:43pm UTC](https://forum.ansible.com/t/passing-command-line-arguments/26838/1 "2018-02-23T14:43:31Z")

</div>

> ---  
> - hosts: all  
> &nbsp;&nbsp;become: yes  
> &nbsp;&nbsp;tasks:  
> &nbsp;&nbsp;&nbsp;&nbsp;- name: create an empty folders  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import\_tasks: /etc/ansible/foldercreation.yml
> 
> &nbsp;&nbsp;&nbsp;&nbsp;- name: Copy rpm file to server  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;copy:  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;src: "{{ item }}"  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dest: /home/user/ansible/rpmpackages/  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;with\_fileglob:  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- /home/user/ansible/rpmpackages/\*
> 
> &nbsp;&nbsp;&nbsp;&nbsp;- name: copy the dynatrace file from home to root  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;shell: sudo mv /home/user/ansible/rpmpackages/dynatrace-agent-6.1.0.7880-unix.jar /compuware/dt/
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;shell: sudo chmod -R 755 /compuware/dt/dynatrace-agent-6.1.0.7880-unix.jar
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;shell: sudo chown -R user /compuware/dt/dynatrace-agent-6.1.0.7880-unix.jar

You are missing a dash in front of the shell:

> &nbsp;&nbsp;&nbsp;&nbsp;- name: install dynatrace  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;expect:  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;command: /opt/SecureSpan/JDK/bin/java -jar /compuware/dt/dynatrace-agent-6.1.0.7880-unix.jar -installDir /compuware/dt/  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;responses:  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The product will be installed to /compuware/dt/dynatrace-6.1.0.  
> Do you want to install to this directory? \(Y/N\): 'Y'
> 
> for dynatarce installation I am getting below error , what could be the  
> reason
> 
> TASK [install dynatrace]  
> \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
> task path: /etc/ansible/installrpm.yml:28  
> changed: [server] =\> {"changed": true, "cmd": "/opt/SecureSpan/JDK/bin/java  
> -jar /compuware/dt/dynatrace-agent-6.1.0.7880-unix.jar -installDir  
> /compuware/dt/", "delta": "0:00:00.183363", "end": "2018-02-19  
> 13:33:46.355043", "rc": 0, "start": "2018-02-19 13:33:46.171680", "stdout":  
> "Invalid argument given!\r\n use \<installer\> -h to list all the available  
> arguments", "stdout\_lines": ["Invalid argument given!", " use \<installer\>  
> -h to list all the available arguments"]}  
> META: ran handlers  
> META: ran handlers

It says "Invalid argument given! use \<installer\> -h to list all the available arguments" so you are running the wrong command in the expect command:.
