-
Notifications
You must be signed in to change notification settings - Fork 1
/
util.rb
32 lines (22 loc) · 882 Bytes
/
util.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Clones the Github repo into a box.
def clone_repo(box, vars, public_repo)
if public_repo
# Clone repo.
box.vm.provision :shell, path: 'vagrant-config/scripts/clone-repo.sh', env: {
:REPO_URL => vars['public-repo-url'],
:REPO_PATH => vars['repo_location'],
}
else
# Copy SSH private key.
box.vm.provision 'file', source: vars['ssh-key-location'], destination: '/home/vagrant/id_rsa'
# Copy SSH config.
box.vm.provision 'file', source: './vagrant-config/config-files/ssh/config', destination: '/home/vagrant/config'
# Set up SSH keys.
box.vm.provision :shell, path: 'vagrant-config/scripts/setup-ssh-keys.sh'
# Clone repo.
box.vm.provision :shell, path: 'vagrant-config/scripts/clone-repo.sh', env: {
:REPO_URL => vars['private-repo-url'],
:REPO_PATH => vars['repo_location'],
}
end
end