Usually, when a pair of private/public SSH keys are generated to be used in connecting securely to remote computers, a “passphrase” is specified to protect the private key from unauthorized use.
There are other cases where a private/public key pair needs to be generated, i.e., when a web server is provided with a certificate to enable the HTTPS protocol.
But the existence of this passphase difficults the automation of processes that involve the establishment of connections to remote computers.
Among other possibilities, the easiest way to solve this issue is just to remove the passphrase that protect the private key. The “openssl” command can be used to generate an unprotected key from the protected key:
$ cd ~/.ssh
$ openssl rsa -in id_rsa -out id_rsa.unprotected
Needless to say, if you choose to do this, you will need to take the appropriate measures to make sure that unauthorized persons can’t access the private key.