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
• 1,170 points
5 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
• 16,920 points

Related Questions In Puppet

+5 votes
2 answers

How To Deploy Windows Server Using Puppet?

Deploying windows server through Puppet is similar ...READ MORE

answered Mar 26, 2018 in Puppet by shubham
• 6,890 points
240 views
0 votes
1 answer
0 votes
1 answer

Service already defines error in Puppet

Hey @Rohan, try this: class MyClass { ...READ MORE

answered Feb 9 in Puppet by Monish
34 views
0 votes
1 answer

Advantages of using puppet

These are the few advantages that makes ...READ MORE

answered Feb 9 in Puppet by Manisha
14 views
+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
111 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
• 16,920 points
15 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
• 16,920 points
15 views