I have a requirement where I need to fetch git repositories using cron jobs via a specific user in Puppet. There's a private key located in my ~/.ssh directory, which I add to my ssh-agent with this exec:
  exec {
  'add-ssh-key':
    cwd => '/home/user/.ssh',
    command => "bash -c 'eval $(ssh-agent) ssh-add rsa_key'",
    path => '/usr/bin:/usr/sbin:/bin:/sbin',
    provider => 'shell'
  }
The agent started, but I cannot pull the repository ie. cron job doesn't execute, may be coz i'm not connected with the correct ssh agent.
What's the work around for this?