-1

Hi fellow overflowers!

I'm trying to write a provisioning script which automatically clones/pulls from a specific private repository on Bitbucket, everytime a vagrant box is initialized.

Ideally, I would like to use a deployment key. But maybe SSH-agent forwarding is also an option, I'm not entirely sure how/if this yields different results.

I have searched half the internet for this and tried so many things, but I can't find the best practice, let alone any clearly explained, working method.

I hope you can help me out!

1 Answers1

0

If you plan to distribute the box and the project, bitbucket deployment key is certainly the best option. I use that for VM that are used only for testing purpose so not linked with defined account.

I personally use puppet provision and do something like

  file_line { 
    'authorized_keys':
       path => '/home/<user>/.ssh/authorized_keys',
       line => 'ssh-rsa XXXX key',
  }
Frederic Henri
  • 51,761
  • 10
  • 113
  • 139
  • Thanks for your response! I am not familiar with Puppet, but does that filepath refer to an "authorized_keys" file on my own machine? Because I want multiple developers (any) to be able to start up the Vagrant box from their own machine and have the resources pulled, without having to worry about having the deployment key sitting somewhere on their own system. – Flip van Wijk Aug 22 '16 at 15:32
  • the `authorized_keys` sits in the VM so you can git clone/pull from inside the VM. – Frederic Henri Aug 22 '16 at 15:46