-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
executable file
·66 lines (52 loc) · 1.98 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
# todo: https://stackoverflow.com/questions/13065576/override-vagrant-configuration-settings-locally-per-dev
Vagrant.configure("2") do |config|
config.vm.box = "debian/contrib-stretch64"
## Forward ssh config
config.ssh.forward_agent = true
config.vm.provision "shell", inline: <<-SHELL
sudo apt-get update
sudo apt-get install -y git
mkdir -p ~/.ssh
chmod 700 ~/.ssh
ssh-keyscan -H github.com >> ~/.ssh/known_hosts
SHELL
## Install Puppet
config.vm.provision :shell, path: "scripts/provision.sh"
# Hostname
config.vm.network :private_network, :ip => "192.168.19.50"
config.vm.network "private_network", type: "dhcp"
# Mount vagrant
config.vm.synced_folder ".", "/vagrant", :group => "www-data", :mount_options => ['dmode=775','fmode=664']
# Puppet LAMP setup
config.vm.provision :puppet do |puppet|
puppet.manifests_path = "puppet/manifests"
puppet.module_path = "puppet/modules"
puppet.manifest_file = "init.pp"
# puppet.options="--verbose --debug"
puppet.synced_folder_args
end
# Performance improvements
# 1. Assign a quarter of host memory and all available CPU's to VM
# Depending on host OS this has to be done differently.
# 2. set --natdnshostresolver1 & --natdnsproxy1 to speed up external connections
config.vm.provider :virtualbox do |vb|
host = RbConfig::CONFIG['host_os']
if host =~ /darwin/
cpus = `sysctl -n hw.ncpu`.to_i
mem = `sysctl -n hw.memsize`.to_i / 1024 / 1024 / 4
elsif host =~ /linux/
cpus = `nproc`.to_i
mem = `grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal://' -e 's/ kB//'`.to_i / 1024 / 4
# Windows...
else
cpus = 4
mem = 2048
end
vb.customize ["modifyvm", :id, "--memory", mem]
vb.customize ["modifyvm", :id, "--cpus", cpus]
vb.customize ['modifyvm', :id, '--natdnshostresolver1', 'on']
vb.customize ['modifyvm', :id, '--natdnsproxy1', 'on']
end
end