inventory file in jenkins server

I have several hosts to manage and, in order to access them, i have to use a couple of different ssh keys (and I set the ansible_ssh_private_key_file in the inventory file to tell ansible which key to use).

The thing is that i’ve been maintaining 2 inventory files versions (which is a pain): one for my station (where ansible_ssh_private_key_file points to my home dir – /home/enyamada/.ssh) and other for jenkins server (with ansible_ssh_private_key_file pointing to /var/jenkins/.ssh files). Everything else is the same.

What’s the best way to circumvent this problem? (and keep a single version?)

Thank you!

I guess /var/jenkins is the home directory for the Jenkins user, in that case you could use ~/.ssh or $HOME/.ssh

Thank you, Kai, it worked.