performance testing - ansible command module: JMeter msg: [Errno 2] No such file or directory -


ansible 1.9.2/latest. os: centos 6.7/later java_home, path variable , other things setup correctly.

i have following playbook runs in perf_tests/tasks/main.yml. run playbook run only, i'm using ansible tags.

# run jmeter tests - name: run jmeter test(s) #  command: "export path={{ jdk_install_dir }}/bin:$path && export java_home={{ jdk_install_dir }} && {{ jmeter_install_dir }}/bin/jmeter -n -t {{ common_download_dir}}/perf_tests/projecttest1.jmx -l {{ common_download_dir}}/perf_tests/log_jmeter_projecttest1.jtl"   command: export path={{ jdk_install_dir }}/bin:$path && export java_home={{ jdk_install_dir }} && /apps/jmeter/apache-jmeter-2.13/bin/jmeter -n -t /tmp/perf_tests/projecttest1.jmx -l /tmp/perf_tests/log_jmeter_projecttest1.jtl   become_user: "{{ common_user }}"   tags:      - giga 

files required jmeter executable present on target machine , i'm using "command" module in ansible start jmeter.

[appuser@jmeter01 ~]$ ls -l /apps/jmeter/apache-jmeter-2.13/bin/jmeter /tmp/perf_tests/projecttest1.jmx -rwxr-xr-x. 1 appuser appgroup  5589 mar  8  2015 /apps/jmeter/apache-jmeter-2.13/bin/jmeter -rw-r--r--. 1 appuser appgroup 50194 oct  2 12:19 /tmp/perf_tests/projecttest1.jmx [appuser@jmeter01 ~]$  [appuser@jmeter01 ~]$ java /apps/jdk/jdk1.7.0_67/bin/java 

when i'm running above playbook run jmeter on .jmx file generate a result .jtl file (using ansible), it's errors out error code 2 (as shown below): msg: [errno 2] no such file or directory

ansible output:

task: [perf_tests | run jmeter test(s)] *************************************** <jmeter01.perf.jenkins> establish connection user: confman on port 22 jmeter01.perf.jenkins <jmeter01.perf.jenkins> remote_module command export path=/apps/jdk/jdk1.7.0_67/bin:$path && export java_home=/apps/jdk/jdk1.7.0_67 && /apps/jmeter/apache-jmeter-2.13/bin/jmeter -n -t /tmp/perf_tests/projecttest1.jmx -l /tmp/perf_tests/log_jmeter_projecttest1.jtl <jmeter01.perf.jenkins> exec /bin/sh -c 'mkdir -p /tmp/ansible-tmp-1443821195.89-232957509929426 && chmod a+rx /tmp/ansible-tmp-1443821195.89-232957509929426 && echo /tmp/ansible-tmp-1443821195.89-232957509929426' <jmeter01.perf.jenkins> put /tmp/tmp6far1w /tmp/ansible-tmp-1443821195.89-232957509929426/command <jmeter01.perf.jenkins> exec /bin/sh -c 'chmod a+r /tmp/ansible-tmp-1443821195.89-232957509929426/command' <jmeter01.perf.jenkins> exec /bin/sh -c 'sudo -k && sudo -h -s -p "[sudo via ansible, key=pkivlaidiolrcxvyxxixeysvrfkpvroy] password: " -u appuser /bin/sh -c '"'"'echo become-success-pkivlaidiolrcxvyxxixeysvrfkpvroy; lang=en_us.utf-8 lc_ctype=en_us.utf-8 /usr/bin/python /tmp/ansible-tmp-1443821195.89-232957509929426/command'"'"'' <jmeter01.perf.jenkins> exec /bin/sh -c 'rm -rf /tmp/ansible-tmp-1443821195.89-232957509929426/ >/dev/null 2>&1' failed: [jmeter01.perf.jenkins] => {"cmd": "export path=/apps/jdk/jdk1.7.0_67/bin:/sbin:/bin:/usr/sbin:/usr/bin '&&' export java_home=/apps/jdk/jdk1.7.0_67 '&&' /apps/jmeter/apache-jmeter-2.13/bin/jmeter -n -t /tmp/perf_tests/projecttest1.jmx -l /tmp/perf_tests/log_jmeter_projecttest1.jtl", "failed": true, "rc": 2} msg: [errno 2] no such file or directory  fatal: hosts have failed -- aborting  play recap ******************************************************************** 

the "cmd" above in ansible's -vvvv verbose output shows, getting passed/expanded ansible calling jmeter command it's failing.

if go remote machine (jmeter01) , "appuser" , run command, works fine , creates -l option provided .jtl result file.

[appuser@jmeter01 ~]$ /apps/jmeter/apache-jmeter-2.13/bin/jmeter -n -t /tmp/perf_tests/projecttest1.jmx -l /tmp/perf_tests/log_jmeter_projecttest1.jtl creating summariser <summary> created tree using /tmp/perf_tests/projecttest1.jmx starting test @ fri oct 02 17:23:50 edt 2015 (1443821030343) waiting possible shutdown message on port 4445 summary =    240 in   4.4s =   54.0/s avg:    82 min:     2 max:  1113 err:     0 (0.00%) tidying ...    @ fri oct 02 17:23:55 edt 2015 (1443821035009) ... end of run [appuser@jmeter01 ~]$ ls -l /tmp/perf_tests total 80 -rw-r--r--. 1 appuser appgroup 50194 oct  2 12:19 projecttest1.jmx -rw-r--r--. 1 appuser appgroup 22412 oct  2 17:23 log_jmeter_projecttest1.jtl drwxr-xr-x. 3 appuser appgroup  4096 oct  2 12:19 meta-inf [appuser@jmeter01 ~]$ 

i'm stumped why jmeter erroring out error while running ansible!!! ?

you can't use export or && command module executes command directly, not through shell, , export shell builtin.

you want shell module.

compare outputs of:

ansible myserver -m command -a "echo hello && echo goodbye" ansible myserver -m command -a "export greet=hello && echo '$greet'"  ansible myserver -m shell -a "echo hello && echo goodbye" ansible myserver -m shell -a "export greet=hello && echo '$greet'" 

and can see clearly.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -