starting karaf with ansble

Hello,

If I run karaf manually with the start command, I have no error.
But if I run the start command in a ansible task, I have the following command:

347 [sshd-SshClient[7a4ccb53]-nio2-thread-1] WARN org.apache.sshd.client.session.ClientSessionImpl - Exception caught
java.lang.IllegalStateException: Unable to negotiate key exchange for kex algorithms (client: ecdh-sha2-nistp256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp384,ecdh-sha2-nistp521,ecdh-sha2-nistp521 / server: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1)
at org.apache.sshd.common.session.AbstractSession.negotiate(AbstractSession.java:1159)
at org.apache.sshd.common.session.AbstractSession.doHandleMessage(AbstractSession.java:388)
at org.apache.sshd.common.session.AbstractSession.handleMessage(AbstractSession.java:326)
at org.apache.sshd.client.session.ClientSessionImpl.handleMessage(ClientSessionImpl.java:306)
at org.apache.sshd.common.session.AbstractSession.decode(AbstractSession.java:780)
at org.apache.sshd.common.session.AbstractSession.messageReceived(AbstractSession.java:308)
at org.apache.sshd.common.AbstractSessionIoHandler.messageReceived(AbstractSessionIoHandler.java:54)
at org.apache.sshd.common.io.nio2.Nio2Session$1.onCompleted(Nio2Session.java:184)
at org.apache.sshd.common.io.nio2.Nio2Session$1.onCompleted(Nio2Session.java:170)
at org.apache.sshd.common.io.nio2.Nio2CompletionHandler$1.run(Nio2CompletionHandler.java:32)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.sshd.common.io.nio2.Nio2CompletionHandler.completed(Nio2CompletionHandler.java:30)
at sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:126)
at sun.nio.ch.Invoker.invokeDirect(Invoker.java:157)
at sun.nio.ch.UnixAsynchronousSocketChannelImpl.implRead(UnixAsynchronousSocketChannelImpl.java:553)
at sun.nio.ch.AsynchronousSocketChannelImpl.read(AsynchronousSocketChannelImpl.java:276)
at sun.nio.ch.AsynchronousSocketChannelImpl.read(AsynchronousSocketChannelImpl.java:297)
at java.nio.channels.AsynchronousSocketChannel.read(AsynchronousSocketChannel.java:420)
at org.apache.sshd.common.io.nio2.Nio2Session.startReading(Nio2Session.java:170)
at org.apache.sshd.common.io.nio2.Nio2Connector$1.onCompleted(Nio2Connector.java:60)
at org.apache.sshd.common.io.nio2.Nio2Connector$1.onCompleted(Nio2Connector.java:53)
at org.apache.sshd.common.io.nio2.Nio2CompletionHandler$1.run(Nio2CompletionHandler.java:32)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.sshd.common.io.nio2.Nio2CompletionHandler.completed(Nio2CompletionHandler.java:30)
at sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:126)
at sun.nio.ch.Invoker$2.run(Invoker.java:218)
at sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)

Any help would be appreciate, I did check the java version, the karaf version , it seems to be related to ansible but I cannot find out the issue.
regards

Maybe your application needs some environment variables which aren’t set when ansible runs the command.

You can set specific environment variables though - see http://docs.ansible.com/ansible/playbooks_environment.html

Jon

I did display the variables when running the
start command and I cannot find out which variable would be a problem.
Any clue ?
Regards

Here are the variables set when the error message is displayed:

A__z=‘“*SHLVL=”*TMOUT’
BASH=/bin/sh
BASHOPTS=cmdhist:extquote:force_fignore:hostcomplete:interactive_comments:progcomp:promptvars:sourcepath
BASH_ALIASES=()
BASH_ARGC=([0]=“1” [1]=“2”)
BASH_ARGV=([0]=“/shrnexus/4you/app5/app5-0.0.0-SNAPSHOT/bin/setenv” [1]=“clean” [2]=“server”)
BASH_CMDS=()
BASH_LINENO=([0]=“12” [1]=“0”)
BASH_SOURCE=([0]=“/shrnexus/4you/app5/app5-0.0.0-SNAPSHOT/bin/setenv” [1]=“/shrnexus/4you/app5/app5-0.0.0-SNAPSHOT/bin/foryou”)
BASH_VERSINFO=([0]=“4” [1]=“2” [2]=“46” [3]=“1” [4]=“release” [5]=“x86_64-redhat-linux-gnu”)
BASH_VERSION=‘4.2.46(1)-release’
CURRENTDIR=/shrnexus/4you/app5/app5-0.0.0-SNAPSHOT/bin
DIRNAME=/shrnexus/4you/app5/app5-0.0.0-SNAPSHOT/bin
DIRSTACK=()
EDITOR=vi
EUID=21175
FCEDIT=vi
GROUPS=()
HISTEDIT=vi
HISTFILESIZE=1000
HISTSIZE=128
HOME=/home/4you
HOSTNAME=server1
HOSTTYPE=x86_64
IFS=’

KARAF_SCRIPT=foryou
LOG=/shr_4you/current/logs
LOGNAME=4you
MACHINE=x86_64-unknown-linux-gnu
MACHTYPE=x86_64-redhat-linux-gnu
MAIL=/var/spool/mail/4you
MANPATH=/usr/share/man:/sopra/tools/man
OLDPWD=/shr_4you
OPTERR=1
OPTIND=1
OSTYPE=linux-gnu
PAGER=more
PATH=/hrasdlcusers/build-tools/unzip/current:/hrasdlcusers/build-tools/java/current/bin:/hrasdlcusers/build-tools/unzip/current:/hrasdlcusers/build-tools/java/current/bin:/hrasdlcusers/build-tools/unzip/current:/hrasdlcusers/build-tools/java/current/bin:/doi/pjunix/4.1/usrbin:/usr/local/bin:/usr/bin:/sbin:/usr/sbin:/bin:/sopra/tools/bin:/sopra/tools/sbin
PIPESTATUS=([0]=“0”)
POSIXLY_CORRECT=y
PPID=1
PROGNAME=foryou
PS4='+ ’
SHELL=/usr/bin/ksh
SHELLOPTS=braceexpand:hashall:interactive-comments:posix
SHLVL=5
SIGACS=/shr_4you
SSH_CLIENT=‘172.21.18.35 49739 22’
SSH_CONNECTION=‘172.21.18.35 49739 10.7.1.4 22’
SSH_TTY=/dev/pts/2
TERM=xterm
TMOUT=7200
TMP=/shr_4you/current/temp
UID=21175
UNZIP_HOME=/hrasdlcusers/build-tools/unzip/current
USER=4you
_=/shrnexus/4you/app5/app5-0.0.0-SNAPSHOT/bin
http_proxy=None
https_proxy=None

Here are the variables set when the start command is running withour error message:

_=3622/usr/bin/env
EDITOR=vi
FCEDIT=vi
HISTEDIT=vi
HISTFILESIZE=1000
HISTSIZE=128
HOME=/home/4you
HOSTNAME=server1
JAVACMD=/hrasdlcusers/build-tools/java/current/bin/java
JAVA_HOME=/hrasdlcusers/build-tools/java/current
LOG=/shr_4you/current/logs
LOGNAME=4you
MACHINE=x86_64-unknown-linux-gnu
MAIL=/var/spool/mail/4you
MANPATH=/usr/share/man:/sopra/tools/man
PAGER=more
PATH=/hrasdlcusers/build-tools/unzip/current:/hrasdlcusers/build-tools/java/current/bin:/doi/pjunix/4.1/usrbin:/usr/local/bin:/usr/bin:/sbin:/usr/sbin:/bin:/sopra/tools/bin:/sopra/tools/sbin
SHELL=/usr/bin/ksh
SHLVL=1
SIGACS=/shr_4you
SSH_CLIENT=172.21.18.35 49739 22
SSH_CONNECTION=172.21.18.35 49739 10.7.1.4 22
SSH_TTY=/dev/pts/2
TERM=xterm
TMOUT=7200
TMP=/shr_4you/current/temp
UNZIP_HOME=/hrasdlcusers/build-tools/unzip/current
USER=4you
A__z=“*SHLVL=”*TMOUT

Is this an init script? It sounds like it relies on something in the
environment.
Does it start at boot cleanly? If not, that's almost certainly the
issue, you might
find setting some variables explicitly in the init script sorts things out.

Sorry I finally found out the issue was not in the start command and then happens in both ways , manually and with ansible.
Don’t pay attention to this ticket, I will keep searching about the issue but it has no link with an ansible issue.

Thank you for your help,
Regards