Hii
As part of our workflow, we receive VMs that are spun up by another team. The VMs contain a single SSH public key, to which we have the private key, which allows us to further deploy them.
Part of this process is to replace the public key with other public keys.
The ansible code that we have, contains the SSH private key that can be used to sign in to the VMs (obviously in a vaulted file).
While setting things up, I found that with both the standard ssh connection module and the paramiko module it is not possible to use a private key that is stored as an ansible variable. They both seem to insist on a key file.
I tried that, and that works. But the ssh connection docs are a bit vague as they only mention the authentication password, and nothing about the private key password.
I found that the docs on the paramiko module are actually correct:
Secret used to either login the ssh server or as a passphrase for ssh keys that require it
This also means I have to have sshpass
installed.
Is there any other way to use a private key from a variable?