|
3 | 3 |
|
4 | 4 | VAGRANTFILE_API_VERSION = "2" |
5 | 5 |
|
| 6 | +# Allow host platform checks |
| 7 | +# http://stackoverflow.com/questions/26811089/vagrant-how-to-have-host-platform-specific-provisioning-steps |
| 8 | +module OS |
| 9 | + def OS.windows? |
| 10 | + (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil |
| 11 | + end |
| 12 | + |
| 13 | + def OS.mac? |
| 14 | + (/darwin/ =~ RUBY_PLATFORM) != nil |
| 15 | + end |
| 16 | + |
| 17 | + def OS.unix? |
| 18 | + !OS.windows? |
| 19 | + end |
| 20 | + |
| 21 | + def OS.linux? |
| 22 | + OS.unix? and not OS.mac? |
| 23 | + end |
| 24 | +end |
| 25 | + |
6 | 26 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| |
7 | 27 |
|
8 | 28 | # vagrant-hostmanager plugin is required |
9 | 29 | unless Vagrant.has_plugin?("vagrant-hostmanager") |
10 | 30 | raise 'vagrant-hostmanager is not installed. run: vagrant plugin install vagrant-hostmanager' |
11 | 31 | end |
12 | 32 |
|
| 33 | + # vagrant-hostsupdater plugin is required |
| 34 | + unless Vagrant.has_plugin?("vagrant-hostsupdater") |
| 35 | + raise 'vagrant-hostsupdater is not installed. run: vagrant plugin install vagrant-hostsupdater' |
| 36 | + end |
| 37 | + |
13 | 38 | # vagrant-vbguest plugin is required |
14 | 39 | unless Vagrant.has_plugin?("vagrant-vbguest") |
15 | | - raise 'vagrant-vbguest is not installed. run: vagrant plugin install vagrant-vbguest' |
| 40 | + raise'vagrant-vbguest is not installed. run: vagrant plugin install vagrant-vbguest' |
16 | 41 | end |
17 | 42 |
|
18 | 43 | config.vm.define "pykcdotdev" do |pykcdotdev| |
19 | | - pykcdotdev.vm.box = "box-cutter/debian81" |
| 44 | + pykcdotdev.vm.box = "debian/jessie64" |
20 | 45 | pykcdotdev.vm.hostname = "pythonkc.dev" |
21 | 46 | pykcdotdev.vm.network "private_network", ip: "192.168.100.101" |
22 | | - pykcdotdev.vm.synced_folder "./", "/vagrant/" |
23 | | - pykcdotdev.vm.synced_folder "./pythonkc_site", "/var/www/pythonkc_site" |
24 | | - # TODO: Create a synced folder location for Ansible playbooks |
| 47 | + if OS.unix? |
| 48 | + pykcdotdev.vm.synced_folder "./", "/vagrant/", type: "nfs" |
| 49 | + elsif OS.windows? |
| 50 | + pykcdotdev.vm.synced_folder "./", "/vagrant/" # , type: "smb" |
| 51 | + else |
| 52 | + raise 'Unknown host operating system. Cannot continue.' |
| 53 | + end |
25 | 54 |
|
26 | 55 | pykcdotdev.vm.provider "virtualbox" do |vb| |
27 | 56 | vb.name = "pykcdotdev" |
|
0 commit comments