I am running ansible-playbook inside docker container on kubernetes. It does copy task and executes a script. Uses private keys. I am invoking it using a java Process. Looks like the ssh pseudo terminals it might be opening stay behind once the playbook is finished executing. Any new playbook invocation adds on to the number of ssh processes. It sort of what this <https://groups.google.com/forum/#!msg/ansible-project/IQoTNwDBIiA/qiHUTgg31lkJ>thread mentions i think, only that I don't see -tt option being appended. I tried turning pty false(which is needed for sftp anyways i think) in ansible.cfg as well. Nothing improves. Once ansible-playbook process dies i will see bunch of defunct [ssh] around. Here are couple lines from the *"ps" output *
root 1627 1 0 00:00 ? 00:00:00 ssh: /root/.ansible/cp/c360b1d939 [mux] root 1629 1 0 00:00 ? 00:00:00 [ssh] <defunct> root 1630 1 0 00:00 ? 00:00:00 ssh: /root/.ansible/cp/e8f6c354e2 [mux] root 1632 1 0 00:00 ? 00:00:00 [ssh] <defunct> root 1633 1 0 00:00 ? 00:00:00 ssh: /root/.ansible/cp/edb897f2b6 [mux] root 1643 1641 0 00:00 ? 00:00:00 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o IdentityFile="/opt/ansible/id_rsa" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=<User> -o ConnectTimeout=5 -o ControlPath=/root/.ansible/cp/b1739bcf8c <machineName> /bin/sh -c '/usr/bin/python && sleep 0' root 1645 1644 0 00:00 ? 00:00:00 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o IdentityFile="/opt/ansible/id_rsa" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=<User> -o ConnectTimeout=5 -o ControlPath=/root/.ansible/cp/d54b353787 <machineName> /bin/sh -c '/usr/bin/python && sleep 0' *Top output* 1 root 20 0 14.980g 1.487g 15156 S 1.3 0.9 4:17.71 java 9377 root 20 0 38376 3440 1248 R 1.0 0.0 0:00.20 top 449 root 20 0 0 0 0 Z 0.0 0.0 0:00.00 ssh 450 root 20 0 0 0 0 Z 0.0 0.0 0:00.04 ssh 453 root 20 0 0 0 0 Z 0.0 0.0 0:00.00 ssh 454 root 20 0 0 0 0 Z 0.0 0.0 0:00.04 ssh 456 root 20 0 0 0 0 Z 0.0 0.0 0:00.00 ssh *Code to invoke playbook:* String[] cmdPurge = { "ansible-playbook", config.getPurgePlaybookPath(), "-i", config.getInventoryLoc(), "--extra-vars", "{\"urls_file\":" + config.getUrlPath() + ",\"type\":\"" + config.getType() + "\",\"purge_file\":\"" + config.getPurgeFile() + "\"}" ,"--private-key",config.getPrivateKeyFile()}; Process pPurge = Runtime.getRuntime().exec(cmdPurge, null); BufferedReader in = new BufferedReader(new InputStreamReader(pPurge.getInputStream())); while ((line = in.readLine()) != null) { //process the console output } in.close(); int exitcode = pPurge.waitFor(); *Ansible.cfg* inventory = hosts remote_user = <User> host_key_checking = False timeout = 5 pty=False pipelining = True *Base Image:* Ubuntu:Xenial *Ansible version* : ansible 2.7.2 using JDK8 I faced same issues using Alpine jdk image and then I switched to ubuntu. -- You received this message because you are subscribed to the Google Groups "Ansible Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-devel+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.