Can't execute reomte script

Hello,

I got two script the first one :
start_jmeter_server_remote.yml :
- hosts: JMETER_REMOTE_VM
sudo: True
user: simsu
tasks:

- command: start_jmeter.sh
args:
chdir: /usr/local/jmeter/apache-jmeter-2.13/bin/

is ment to start jmeter on remote host, but doesn’t work !

start_jmeter.sh :
#!/bin/bash
/usr/local/jmeter/apache-jmeter-2.13/bin/jmeter-server &

failed: [130.190.250.66] => {“cmd”: “start_jmeter.sh”, “failed”: true, “rc”: 2}
msg: [Errno 2] No such file or directory

FATAL: all hosts have already failed – aborting

christophe

you need to give it the full path to start_jmeter.sh

I changed the first script to :

- hosts: JMETER_REMOTE_VM
sudo: True
user: simsu
gather_facts: False
tasks:
- command: /usr/local/jmeter/apache-jmeter-2.13/bin/start_jmeter.sh
args:
chdir: /usr/local/jmeter/apache-jmeter-2.13/bin/

still doesn’t start jmeter on remote host !

Try shell: instead, you might need that… Also make sure it’s executable… (Stating the obvious) …

Alex

also it will be helpful if you post the output of the task

ansible-playbook start_jmeter_server_remote_1.yml --ask-sudo-pass -vvvv

SUDO password:

PLAY [JMETER_REMOTE_VM] *******************************************************

GATHERING FACTS ***************************************************************

<130.190.250.66> ESTABLISH CONNECTION FOR USER: simsu

<130.190.250.66> REMOTE_MODULE setup

<130.190.250.66> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/root/.ansible/cp/ansible-ssh-%h-%p-%r” -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=simsu -o ConnectTimeout=10 130.190.250.66 /bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1453882475.17-68023331377793 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1453882475.17-68023331377793 && echo $HOME/.ansible/tmp/ansible-tmp-1453882475.17-68023331377793’

<130.190.250.66> PUT /tmp/tmpijHPWy TO /home/simsu/.ansible/tmp/ansible-tmp-1453882475.17-68023331377793/setup

<130.190.250.66> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/root/.ansible/cp/ansible-ssh-%h-%p-%r” -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=simsu -o ConnectTimeout=10 130.190.250.66 /bin/sh -c ‘sudo -k && sudo -H -S -p “[sudo via ansible, key=zowdykhpfmzccljfrohbyspkgyhejhqj] password: " -u root /bin/sh -c '”’“‘echo BECOME-SUCCESS-zowdykhpfmzccljfrohbyspkgyhejhqj; LANG=C LC_CTYPE=C /usr/bin/python /home/simsu/.ansible/tmp/ansible-tmp-1453882475.17-68023331377793/setup; rm -rf /home/simsu/.ansible/tmp/ansible-tmp-1453882475.17-68023331377793/ >/dev/null 2>&1’”‘"’’

ok: [130.190.250.66]

TASK: [command /usr/local/jmeter/apache-jmeter-2.13/bin/start_jmeter.sh] ******

<130.190.250.66> ESTABLISH CONNECTION FOR USER: simsu

<130.190.250.66> REMOTE_MODULE command chdir=/usr/local/jmeter/apache-jmeter-2.13/bin/ /usr/local/jmeter/apache-jmeter-2.13/bin/start_jmeter.sh

<130.190.250.66> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/root/.ansible/cp/ansible-ssh-%h-%p-%r” -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=simsu -o ConnectTimeout=10 130.190.250.66 /bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1453882477.7-240100734924544 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1453882477.7-240100734924544 && echo $HOME/.ansible/tmp/ansible-tmp-1453882477.7-240100734924544’

<130.190.250.66> PUT /tmp/tmp2aAt4A TO /home/simsu/.ansible/tmp/ansible-tmp-1453882477.7-240100734924544/command

<130.190.250.66> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/root/.ansible/cp/ansible-ssh-%h-%p-%r” -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=simsu -o ConnectTimeout=10 130.190.250.66 /bin/sh -c ‘sudo -k && sudo -H -S -p “[sudo via ansible, key=zqnpetjkcglujinqbfeuiqaspgfrjfgc] password: " -u root /bin/sh -c '”’“‘echo BECOME-SUCCESS-zqnpetjkcglujinqbfeuiqaspgfrjfgc; LANG=C LC_CTYPE=C /usr/bin/python /home/simsu/.ansible/tmp/ansible-tmp-1453882477.7-240100734924544/command; rm -rf /home/simsu/.ansible/tmp/ansible-tmp-1453882477.7-240100734924544/ >/dev/null 2>&1’”‘"’’

changed: [130.190.250.66] => {“changed”: true, “cmd”: [“/usr/local/jmeter/apache-jmeter-2.13/bin/start_jmeter.sh”], “delta”: “0:00:01.810392”, “end”: “2016-01-27 09:29:35.613533”, “rc”: 0, “start”: “2016-01-27 09:29:33.803141”, “stderr”: “”, “stdout”: “Created remote object: UnicastServerRef [liveRef: [endpoint:130.190.250.66:50469,objID:[-cba3997:1528233bbad:-7fff, -4566448809460184707]]]”}

PLAY RECAP ********************************************************************
130.190.250.66 : ok=2 changed=1 unreachable=0 failed=0

so no errors on execution of the script, I don't think the issue is
with ansible at this point.