Unable to find identity file in home directory of user running Ansible #334
Comments
This looks strange! OpenSSH handles tilde expansion internally (i.e. it's not a side-effect of Ansible passing "~/your.key" through the shell. Would it be possible for you to run this again, and search for a command like below in your "-vvv" output:
I'm only interested in the options passed to SSH, the hostname and base64'd blob don't matter. Can you also please run the same with -vvv under regular Ansible, and return one of the lines like:
Finally can you confirm the current working directory when Jenkins runs Ansible (is it the same as the home directory?) and also whether the value of $HOME looks like it makes sense. I'm thinking the underlying problem here might be the current working directory has changed, the SSH client is somehow being executed in the wrong account, or an environment difference means HOME is incorrect when running under Jenkins somehow (which would not surprise me) |
Sure: With ANSIBLE_STRATEGY=mitogen_linear (unneeded info removed):
Without mitogen enabled (removed -o ControlPath from output): Yes, the current working directory is the home directory, and the value of $HOME=/var/jenkins. I notice in the non-mitogen run it uses the full path to the home directory. |
Just to update, I manually changed the path to the key file in the inventory (it's set via the ansible_ssh_private_key_file variable) from using a tilde to the full path to the user's home directory, and it works while using mitogen_linear. So it's definitely that expansion that it's bugging out on. |
Okay:
The problem is because with vanilla, we use $HOME in the environment to expand the path, whereas in Mitogen we let SSH do that, which uses If using |
So sorry for the huge wait on this one! Debugging these expansions is a real pain -- sometimes there are multiple nested layers of /bin/sh involved in upstream, and it's impossible without actually running things under This is now on the master branch and will make it into the next release. To be updated when a new release is made, subscribe to https://networkgenomics.com/mail/mitogen-announce/ Thanks for reporting this! |
No worries at all, I appreciate the effort! I track the master branch so I can already go ahead and try this out on our Jenkins agent. |
I tried this out today and it's now working for me. Thanks! |
I'm running the latest master (commit #232aaf5c) and getting the following error when a playbook is run from our Jenkins agent server, as the Jenkins user:
When this is run without mitogen it works fine, for some reason it can't find the ssh key file in the jenkins user's home folder (or it can't find the home folder at all).
Controller
Uname: Linux XXXXXXXXXX 3.13.0-153-generic #203-Ubuntu SMP Thu Jun 14 08:52:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Distributor ID: Ubuntu
Description: Ubuntu 14.04.5 LTS
Release: 14.04
Codename: trusty
Ansible
ansible 2.4.6.0 (detached HEAD ref: refs/) last updated 2018/08/01 22:18:08 (GMT +000)
config file = /var/jenkins/.ansible.cfg
configured module search path = [u'/var/jenkins/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /opt/ansible/ansible-2.4/lib/ansible
executable location = /opt/ansible/ansible-2.4/bin/ansible
python version = 2.7.6 (default, Nov 23 2017, 15:49:48) [GCC 4.8.4]
Notes: Added 'strategy_plugins = /path/to/mitogen-master/ansible_mitogen/plugins/strategy' to defaults and ran ansible-playbook with 'ANSIBLE_STRATEGY=mitogen_linear' set.
Host(s)
Uname: Linux XXXXXXXXXXXX 3.13.0-153-generic #203-Ubuntu SMP Thu Jun 14 08:52:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Distributor ID: Ubuntu
Description: Ubuntu 14.04.5 LTS
Release: 14.04
Codename: trusty
Python 2.7.6
The text was updated successfully, but these errors were encountered: