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, 2019 in Puppet by Karan
• 10,080 points
70 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, 2019 by Sirajul
• 52,710 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, 2019 in Puppet by Sirajul
• 52,710 points
32 views
0 votes
1 answer

Puppet in Docker: Configuring Puppet containers using Docker compose.

Using Docker compose you can define a set ...READ MORE

answered Aug 20, 2019 in Puppet by Sirajul
• 52,710 points
282 views
0 votes
1 answer
0 votes
1 answer

Puppet+Kubernetes: Is there a way to create resources in Kubernetes using Puppet?

Yes, it is quite possible to create ...READ MORE

answered Aug 23, 2019 in Puppet by Sirajul
• 52,710 points
84 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,400 points
484 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, 2019 in Puppet by Sirajul
• 52,710 points
113 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, 2019 in Puppet by Sirajul
• 52,710 points
67 views