Can't fetch git repositories in puppet using ssh

0 votes

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?

Aug 8 in Puppet by Karan
• 3,770 points
25 views

1 answer to this question.

0 votes

Try adding a section to the user's ~/.ssh/config file to instruct it to use the key when connecting to the git server.

Host my-git-server
    Hostname git.example.net
    User gituser
    IdentityFile /home/user/.ssh/rsa_key

Make sure that Puppet ensures the private key has appropriately limited permissions.There's no role of ssh-agent here.

answered Aug 8 by Sirajul
• 31,180 points

Related Questions In Puppet

0 votes
1 answer

Puppet in Docker : Benefit of using puppet in docker

Here's to how this approach proves beneficial: One ...READ MORE

answered Aug 19 in Puppet by Sirajul
• 31,180 points
13 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
181 views
0 votes
1 answer
0 votes
1 answer

How do I enable puppet collection repository in puppet if I am using Puppet 6.7?

In Puppet6.7 you have to enable Puppet ...READ MORE

answered Jul 31 in Puppet by Sirajul
• 31,180 points
33 views
0 votes
1 answer

Puppet : Can i install jenkins on a puppet server using Git?

Installing puppet-jenkins is easy. To install via Git, ...READ MORE

answered Aug 9 in Puppet by Sirajul
• 31,180 points
32 views