forked from legco-watch/legco-watch
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathVagrantfile.bak
89 lines (70 loc) · 2.57 KB
/
Vagrantfile.bak
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'rbconfig'
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
$is_windows = (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/)
def provision(box, playbook, hosts)
# Run the shell provisioner with a specified playbook and inventory
playbook_path = "devops/" + playbook
inventory_path = "devops/" + hosts
if $is_windows
# Provisioning configuration for shell script.
box.vm.provision "shell" do |sh|
sh.path = "provision.sh"
sh.args = playbook_path + " " + inventory_path
end
else
# Provisioning configuration for Ansible (for Mac/Linux hosts).
box.vm.provision "ansible" do |ansible|
ansible.playbook = playbook_path
ansible.inventory_path = inventory_path
ansible.sudo = true
end
end
end
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define "default" do |dev|
# Dev box
dev.vm.box = "hashicorp/precise32"
dev.vm.hostname = "dev"
dev.vm.network "private_network", ip: "192.168.221.3"
dev.vm.provider "virtualbox" do |v|
v.memory = 1024
v.cpus = 2
v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]
end
dev.vm.synced_folder ".", "/vagrant",
type: "nfs"
# type: "rsync",
# rsync__exclude: [".idea/"],
# rsync__auto: true,
# rsync__args: ["--verbose", "--archive", "-z", "--perms"]
provision(dev, "dev.yml", "dev.hosts")
end
config.vm.define "stage", autostart: false do |stage|
# Staging environment
stage.vm.box = "hashicorp/precise32"
stage.vm.hostname = "stage"
stage.vm.network "private_network", ip: "192.168.221.4"
# must disable default ssh first
# https://github.com/mitchellh/vagrant/issues/3232
stage.vm.network "forwarded_port", guest:22, host: 2224, auto_correct: false, id: "ssh"
# stage.vm.network "forwarded_port", guest:22, host: 2224, auto_correct: true
stage.vm.provider "virtualbox" do |v|
v.memory = 1024
v.cpus = 2
v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]
end
stage.vm.synced_folder ".", "/vagrant", disabled: true
=begin
# Don't provision and sync folders on the stage machine
# do the provisioning from the dev environment to simulate cloud deploy
stage.vm.synced_folder ".", "/vagrant",
type: "rsync",
rsync__exclude: [".idea/"],
rsync__auto: true
provision(stage, "stage.yml", "stage.hosts")
=end
end
end