-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathVagrantfile
executable file
·157 lines (132 loc) · 6.1 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
145
146
147
148
149
150
151
152
153
154
155
156
157
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'yaml'
#
# Issues with MS, see: https://github.com/Varying-Vagrant-Vagrants/VVV/issues/354#issuecomment-181513066
#
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
ANSIBLE_TAGS=ENV['ANSIBLE_TAGS']
ANSIBLE_TAGS_SKIP=ENV['ANSIBLE_TAGS_SKIP']
# Custom settings which can be overriden via Vagrantfile.local.yml
atlantis_synced_folder_webdev = "~/Documents/webdev/development"
atlantis_synced_folder_mount_options = 'dmode=0775,fmode=0664'
atlantis_synced_folder_type = "virtualbox"
atlantis_synced_folder_smb_username = ""
atlantis_synced_folder_smb_password = ""
atlantis_vm_hostname = "atlantis"
atlantis_vm_box_url = "Vagrant-Boxes/xenial64.box"
dir = File.dirname(File.expand_path(__FILE__))
if File.file?("#{dir}/Vagrantfile.local.yml")
custom_settings = YAML.load_file("#{dir}/Vagrantfile.local.yml")
if custom_settings['synced_folder']['webdev_folder']
atlantis_synced_folder_webdev = custom_settings['synced_folder']['webdev_folder']
end
if custom_settings['synced_folder']['mount_options']
atlantis_synced_folder_mount_options = custom_settings['synced_folder']['mount_options']
end
if custom_settings['synced_folder']['type']
atlantis_synced_folder_type = custom_settings['synced_folder']['type']
end
if custom_settings['synced_folder']['smb_username']
atlantis_synced_folder_smb_username = custom_settings['synced_folder']['smb_username']
end
if custom_settings['synced_folder']['smb_password']
atlantis_synced_folder_smb_password = custom_settings['synced_folder']['smb_password']
end
if custom_settings['vm']['hostname']
atlantis_vm_hostname = custom_settings['vm']['hostname']
end
if custom_settings['vm']['box_url']
atlantis_vm_box_url = custom_settings['vm']['box_url']
end
end
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
if Vagrant.has_plugin?("vagrant-cachier")
config.cache.scope = :machine
end
############
# ATLANTIS #
############
config.vm.define "atlantis" do |atlantis|
atlantis.vm.box = "atlantis"
atlantis.vm.hostname = atlantis_vm_hostname
atlantis.vm.box_url = atlantis_vm_box_url
atlantis.vm.network :private_network, ip: "192.168.80.2"
atlantis.vm.synced_folder atlantis_synced_folder_webdev, "/var/www/vhosts", owner: "deploy", group: "www-data", :mount_options => [atlantis_synced_folder_mount_options], type: atlantis_synced_folder_type, smb_username: atlantis_synced_folder_smb_username, smb_password: atlantis_synced_folder_smb_password
atlantis.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--cpus", 2, "--memory", 2048, "--name", "vagrant-atlantis", "--natdnshostresolver1", "on"]
end
# atlantis.vm.provision "shell", inline: <<-SHELL
# echo "ubuntu:ubuntu" | sudo chpasswd
# sudo apt install python -y
# SHELL
end
###################
# ATLANTIS.CENTOS #
###################
config.vm.define "atlantis.centos" do |atlantiscentos|
atlantiscentos.vm.box = "atlantis.centos"
atlantiscentos.vm.hostname = "atlantis.centos"
atlantiscentos.vm.box_url = "Vagrant-Boxes/centos64.box"
atlantiscentos.vm.network :private_network, ip: "192.168.80.3"
atlantiscentos.vm.synced_folder atlantis_synced_folder_webdev, "/var/www/vhosts", owner: "deploy", group: "www-data", :mount_options => ['dmode=0775,fmode=0775']
atlantiscentos.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--cpus", 2, "--memory", 2048, "--name", "vagrant-atlantis-centos", "--natdnshostresolver1", "on"]
end
end
###########
# TESTING #
###########
config.vm.define "testing" do |testing|
testing.vm.box = "testing"
testing.vm.hostname = "testing"
testing.vm.box_url = "Vagrant-Boxes/xenial64.box"
testing.vm.network :private_network, ip: "192.168.90.2"
testing.vm.boot_timeout = 400 # defaults 300
testing.vm.synced_folder "~/Documents/webdev/development", "/var/www/vhosts", owner: "deploy", group: "www-data", :mount_options => ['dmode=0775,fmode=0775']
testing.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--cpus", 1, "--memory", 512, "--name", "vagrant-testing", "--natdnshostresolver1", "on"]
end
testing.vm.provision "fix-no-tty", type: "shell" do |s|
s.privileged = false
s.inline = "sudo sed -i '/tty/!s/mesg n/tty -s \\&\\& mesg n/' /root/.profile"
end
testing.vm.provision "ansible" do |ansible|
ansible.playbook = "playbooks/generic.yml"
ansible.inventory_path = "~/.appflow/tenant/appflow-ttss/development/inventory"
ansible.vault_password_file = "~/.appflow/vault/ttss/development"
ansible.become = true
ansible.tags = ANSIBLE_TAGS
end
end
##################
# TESTING.CENTOS #
##################
config.vm.define "testing.centos" do |testingcentos|
testingcentos.vm.box = "testing.centos"
testingcentos.vm.hostname = "testing.centos"
# TESTFIX
testingcentos.vm.host_name = 'testing.centos'
# TESTFIX
testingcentos.vm.box_url = "Vagrant-Boxes/centos-ttss.box"
testingcentos.vm.network :private_network, ip: "192.168.90.3"
config.vm.synced_folder ".", "/home/vagrant/sync", disabled: true
# testingcentos.vm.synced_folder "~/Documents/webdev/development", "/var/www/vhosts", owner: "deploy", group: "www-data", :mount_options => ['dmode=0775,fmode=0775']
testingcentos.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--cpus", 1, "--memory", 512, "--name", "vagrant-testing-centos", "--natdnshostresolver1", "on"]
end
# testingcentos.vm.provision "fix-no-tty", type: "shell" do |s|
# s.privileged = false
# s.inline = "sudo sed -i '/tty/!s/mesg n/tty -s \\&\\& mesg n/' /root/.profile"
# end
testingcentos.vm.provision "ansible" do |ansible|
ansible.playbook = "playbooks/generic.yml"
ansible.inventory_path = "~/.appflow/tenant/appflow-ttss/development/inventory"
ansible.vault_password_file = "~/.appflow/vault/ttss/development"
ansible.become = true
ansible.tags = ANSIBLE_TAGS
ansible.skip_tags = ANSIBLE_TAGS_SKIP
end
end
end