stored passphrase for ssh key

Does anyone know a way to store an ssh passphrase during a playbook run? All nodes have the same ssh key/passphrase. I just don’t want to type the same passphrase 100 times during the playbook run. Is there any way to do this with passphrases?

Define a variable to fetch it from file.

Figured it out. Add the following to your bash_profile:

`

Configure ssh-agent (begin)

SSH_ENV=“$HOME/.ssh/environment”
function start_agent {
echo “Initializing new SSH agent…”
/usr/bin/ssh-agent |sed ‘s/^echo/#echo/’ > “${SSH_ENV}”
echo succeeded
chmod 600 “${SSH_ENV}”
. “${SSH_ENV}” > /dev/null
/usr/bin/ssh-add ~/.ssh/$(whoami);
}

Source SSH settings, if required

if [ -f “${SSH_ENV}” ]; then
. “${SSH_ENV}” > /dev/null
ps -ef |grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
start_agent;
}
else
start_agent;
fi

Configure ssh-agent (end)

`