0

I'am trying to execute the feature:list command of Karaf on centos 7 with ansible playbook.

Running this command on terminal works fine:

sudo /opt/runtimeV8/Talend-Runtime-V8.0.1/bin/start;sleep 30;/opt/runtimeV8/Talend-Runtime-V8.0.1/bin/client -r 20 feature:list > /tmp/log.txt

enter image description here

I want to run same command with Ansible but last command goes into error.

  - name: Command 1
    shell: sudo /opt/runtimeV8/Talend-Runtime-V8.0.1/bin/start

  - name: Command 2
    command: sleep 30

  - name: Command 3
    shell:  /opt/runtimeV8/Talend-Runtime-V8.0.1/bin/client feature:list > /tmp/log.txt
    ignore_errors: true

Even the ignore-errors seems not to be changing big thing.

"msg": "non-zero return code"

enter image description here

and the log file only contains the first line of the output :

enter image description here

Safus09
  • 89
  • 2
  • 12

1 Answers1

0

Batch mode should be used and the command would become:

  - name: Command 3
    shell: $KARAF_HOME/bin/client  -b <<< "feature:list" > /tmp/log.txt
    ignore_errors: true

answer found here : https://stackoverflow.com/questions/70355095/unable-to-run-client-command-for-apache-karaf-4-3-3-through-remote-server

Safus09
  • 89
  • 2
  • 12