-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathVagrantfile
144 lines (118 loc) · 4.56 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#-*- mode: ruby -*-
# vi: set ft=ruby :
# Validate Plugins
unless Vagrant.has_plugin?("vagrant-hosts")
raise 'vagrant-hosts is not installed!'
end
unless Vagrant.has_plugin?("vagrant-hostsupdater")
raise 'vagrant-hostsupdater is not installed!'
end
unless Vagrant.has_plugin?("vagrant-vbguest")
raise 'vagrant-vbguest is not installed!'
end
# Startup Script
$script = <<SCRIPT
/bin/sleep 5;
sudo systemctl restart network || true;
/bin/sleep 5;
SCRIPT
Vagrant.configure(2) do |vagrant|
# Provider Setup
vagrant.vm.provider "virtualbox" do |v|
v.memory = 1024
v.cpus = 1
v.customize ["modifyvm", :id, "--hwvirtex", "on"]
end
# TuxLab Swarm Controller
vagrant.vm.define "dswarm" do |dswarm|
dswarm.vm.box = "centos/atomic-host"
dswarm.vm.box_version = "1706.01"
# Disable Guest Additions Installing
dswarm.vm.provider :virtualbox do |v|
# On VirtualBox, we don't have guest additions or a functional vboxsf
# in CoreOS, so tell Vagrant that so it can be smarter.
v.check_guest_additions = false
v.functional_vboxsf = false
end
if Vagrant.has_plugin?("vagrant-vbguest") then
dswarm.vbguest.auto_update = false
end
# Disable Folder Syncing
dswarm.vm.synced_folder '.', '/home/vagrant/sync', disabled: true
# Setup Network and SSH
dswarm.vm.network "private_network", ip: "10.100.1.10"
dswarm.hostsupdater.aliases = ["dswarm.tuxlab.local"]
dswarm.vm.provision :hosts do |provisioner|
provisioner.autoconfigure = true
provisioner.sync_hosts = true
provisioner.add_host '10.100.1.10', ['dswarm.tuxlab.local']
end
# Use Private Key
dswarm.ssh.insert_key = false
dswarm.ssh.private_key_path = '~/.vagrant.d/insecure_private_key'
# Force Refresh Network
dswarm.vm.provision "shell", inline: $script
end
# TuxLab Swarm Host
vagrant.vm.define "dhost" do |dhost|
dhost.vm.box = "centos/atomic-host"
dhost.vm.box_version = "1706.01"
# Disable Guest Additions Installing
dhost.vm.provider :virtualbox do |v|
# On VirtualBox, we don't have guest additions or a functional vboxsf
# in CoreOS, so tell Vagrant that so it can be smarter.
v.check_guest_additions = false
v.functional_vboxsf = false
end
if Vagrant.has_plugin?("vagrant-vbguest") then
dhost.vbguest.auto_update = false
end
# Disable Folder Syncing
dhost.vm.synced_folder '.', '/home/vagrant/sync', disabled: true
# Setup Network and SSH
dhost.vm.network "private_network", ip: "10.100.1.11"
dhost.hostsupdater.aliases = ["dhost.tuxlab.local"]
dhost.vm.provision :hosts do |provisioner|
provisioner.autoconfigure = true
provisioner.sync_hosts = true
provisioner.add_host '10.100.1.11', ['dhost.tuxlab.local']
end
dhost.ssh.insert_key = false
dhost.ssh.private_key_path = '~/.vagrant.d/insecure_private_key'
# Force Refresh Network
dhost.vm.provision "shell", inline: $script
end
# Meteor Host
vagrant.vm.define "meteor" do |meteor|
meteor.vm.box = "centos/7"
meteor.vm.provider :virtualbox do |v|
v.memory = 2048
v.cpus = 1
end
# Disable Folder Syncing
meteor.vm.synced_folder ".", "/vagrant", disabled: true
meteor.vm.synced_folder "./app", "/tuxlab-sync", type: "rsync", rsync__exclude: [".git",".meteor/local/","private/","node_modules/"]
# Set Key
meteor.ssh.username="vagrant"
meteor.ssh.insert_key = false
meteor.ssh.private_key_path = '~/.vagrant.d/insecure_private_key'
# Add to Network
meteor.vm.network "private_network", ip: "10.100.1.2"
meteor.hostsupdater.aliases = ["tuxlab.local", "meteor.tuxlab.local"]
meteor.vm.provision :hosts do |provisioner|
provisioner.autoconfigure = true
provisioner.sync_hosts = true
provisioner.add_host '10.100.1.11', ['tuxlab.local', 'meteor.tuxlab.local']
end
meteor.vm.provision "shell", inline: $script
# Configure All Hosts via Ansible
meteor.vm.provision :ansible do |ansible|
ansible.playbook = "./setup.yml"
ansible.limit = 'all'
ansible.force_remote_user = false
ansible.host_key_checking = false
ansible.inventory_path = "./local/vagrant_ansible_inventory"
#ansible.verbose = true
end
end
end