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
• 19,610 points
799 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
• 59,230 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
• 59,230 points
663 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
• 59,230 points
1,874 views
0 votes
1 answer

Puppet+Kubernetes: How do I use kubetool and what is it's significance in using kubernetes with puppet?

The module puppetlabs/kubernetes has Kubetool, which is ...READ MORE

answered Aug 21, 2019 in Puppet by Sirajul
• 59,230 points
1,175 views
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
• 59,230 points
978 views
+15 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 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,036 views
+2 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
• 59,230 points
1,278 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
• 59,230 points
703 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP