jenkins ssh-agent ansible

139 views
Skip to first unread message

AC

unread,
Oct 26, 2016, 2:16:37 PM10/26/16
to Jenkins Users
Hello,

I have Ansible installed on my Jenkins master. The Jenkins Ansible plugin was working and completing jobs until I switched over to using ssh-agent to encrypt my private key. However, I can still run Ansible commands from the Jenskins Master CLI but not from the Jenkins Ansible Plugin.

Does Jenkins not run the jobs as the Jenkins user which has ssh-agent running? Does anyone know if there is a way to do this?

Thanks!

AC

unread,
Oct 26, 2016, 2:43:05 PM10/26/16
to Jenkins Users
I think this actually has to do with the ssh-agent not running in the same session. If this is the case is my only option to use the Jenkins ssh-agent plugin?

jcsirot

unread,
Oct 27, 2016, 3:37:22 PM10/27/16
to Jenkins Users
Hello,

Ansible is launched as a subprocess of Jenkins server and is therefore using the same user. However I'm not really familiar with ssh-agent. I'm going to try to reproduce this issue and see if there is something I can do in the plugin code to help you.

Regards,

-- 
Jean-Christophe

Matthew Wilmott

unread,
Jun 29, 2017, 2:12:01 AM6/29/17
to Jenkins Users
Did anything come of the investigation Jean-Christophe?

I've got some keys I need to provide Ansible in order to jump through bastion hosts. They differ from the credentials supplied to Ansible itself (the target host credential)

I'd normally add these keys to an ssh config and be done with it but within Jenkins I need to store these in the credential store. Without knowing the credential path for prior, there is no means of adding the path to the config hence the reliance on ssh-agent 

If this could be achieved it would be excellent.

Matt
Reply all
Reply to author
Forward
0 new messages