-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
61 lines (49 loc) · 2.17 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
# example: vagrant --arg1 up
# vagrant --cloud up --provider=virtualbox
# vagrant --local destroy -f
# vagrant --local ssh database_server
# vagrant --cloud up --provider=digital_ocean
# vagrant --cloud destroy -f
# vagrant --cloud ssh database_server
arg = ARGV[0]
puts "Argument is: #{arg}"
Vagrant.configure("2") do |config|
config.puppet_install.puppet_version = '6.24.0'
####### Provision with puppet #######
config.vm.provision "puppet" do |puppet|
puppet.options = "--verbose --debug"
puppet.environment_path = "./environments"
puppet.environment = "cloud"
end
NODES = [
{ :hostname => "appserver", :name => "application_server"},
{ :hostname => "dbserver", :name => "database_server"}
]
NODES.each do |node|
config.vm.define node[:name] do |config|
config.vm.hostname = node[:hostname]
case arg
when "--local"
puts "Provisioning for local"
config.vm.box = "bento/ubuntu-18.04"
when "--cloud"
puts "Provisioning for cloud"
config.vm.provider :digital_ocean do |provider, override|
override.ssh.private_key_path = '~/.ssh/digitalocean'
override.vm.box = 'digital_ocean'
override.vm.box_url = "https://github.com/devopsgroup-io/vagrant-digitalocean/raw/master/box/digital_ocean.box"
override.nfs.functional = false
override.vm.allowed_synced_folder_types = :rsync
provider.token = ENV['DIGITALOCEAN_TOKEN'] # Located in /etc/environment
provider.image = 'ubuntu-18-04-x64'
provider.region = 'nyc1'
provider.size = 's-1vcpu-1gb'
provider.backups_enabled = false
provider.private_networking = false
provider.ipv6 = false
provider.monitoring = false
end
end
end
end
end