forked from thmttch/chef-continuum-anaconda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
75 lines (65 loc) · 2.12 KB
/
Vagrantfile
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
Vagrant.configure('2') do |config|
config.vm.hostname = 'anaconda-berkshelf'
# 16.04 LTS
config.vm.box = 'ubuntu/xenial64'
config.vm.network :private_network, ip: '33.33.33.123'
# ssh
config.ssh.forward_x11 = true
config.ssh.forward_agent = true
# plugins
config.berkshelf.enabled = true
config.omnibus.chef_version = :latest
# vm tweaks
config.vm.provider :virtualbox do |vb|
#vb.memory = 1024
#vb.cpus = 2
# "no matter how much CPU is used in the VM, no more than 50% would be used
# on your own host machine"
# http://docs.vagrantup.com/v2/virtualbox/configuration.html
#vb.customize [ 'modifyvm', :id, '--cpuexecutioncap', '50' ]
end
# provisioning
# dev optimization: anaconda installers are big, so put it in the guest's
# chef cache if it's available on the host
#
# TODO: need to increase the virtualbox disk space for the installers, eg
# https://unix.stackexchange.com/questions/176687/set-storage-size-on-creation-of-vm-virtualbox
config.trigger.before :provision, :stdout => true do
run_remote <<-SCRIPT
VAGRANT_MOUNT=/vagrant/docker/container/installers
if [[ -d ${VAGRANT_MOUNT} ]]; then
for f in $(ls ${VAGRANT_MOUNT}); do
echo "checking for ${f} in cache"
if [[ ! -f /var/chef/cache/${f} ]]; then
cp -v ${VAGRANT_MOUNT}/${f} /var/chef/cache
else
echo "${f} already in cache"
fi
done
fi
SCRIPT
end
config.vm.provision :chef_solo do |chef|
chef.json = {
'anaconda' => {
'accept_license' => 'yes',
'notebook' => {
# set an empty security token, which effectively disables this
# security feature; this is for the quickstart Vagrant image ONLY!
'use_provided_token' => true,
'token' => '',
}
}
}
chef.run_list = [
'recipe[anaconda::default]',
'recipe[anaconda::shell_conveniences]',
'recipe[anaconda::notebook_server]',
]
chef.custom_config_path = 'vagrant-solo.rb'
#chef.log_level = :debug
#chef.verbose_logging = true
end
end
# -*- mode: ruby -*-
# vi: set ft=ruby :