|
| 1 | +unless Vagrant.has_plugin?('vagrant-berkshelf') |
| 2 | + puts "Please install vagrant plugin vagrant-berkshelfs first\n" |
| 3 | + puts " vagrant plugin install vagrant-berkshelf\n\n" |
| 4 | + puts "Exit vagrant\n\n" |
| 5 | + abort |
| 6 | +end |
| 7 | + |
| 8 | +unless Vagrant.has_plugin?('vagrant-omnibus') |
| 9 | + puts "Please install vagrant plugin vagrant-omnibus first\n" |
| 10 | + puts " vagrant plugin install vagrant-omnibus\n\n" |
| 11 | + puts "Exit vagrant\n\n" |
| 12 | + abort |
| 13 | +end |
| 14 | + |
| 15 | +Vagrant.require_version '>= 1.8.1' |
| 16 | +chef_version = '12.9.41' |
| 17 | + |
| 18 | +Vagrant.configure('2') do |config| |
| 19 | + domain = 'dkdeploy-php.dev' |
| 20 | + domain_second = 'second-dkdeploy-php.dev' |
| 21 | + ip_address = '192.168.156.181' |
| 22 | + |
| 23 | + config.vm.box = 'ubuntu/trusty64' |
| 24 | + config.vm.box_check_update = false |
| 25 | + config.berkshelf.enabled = true |
| 26 | + config.omnibus.chef_version = chef_version |
| 27 | + |
| 28 | + config.vm.define('dkdeploy-php', primary: true) do |master_config| |
| 29 | + master_config.vm.network 'private_network', ip: ip_address |
| 30 | + |
| 31 | + # Chef settings |
| 32 | + master_config.vm.provision :chef_solo do |chef| |
| 33 | + chef.version = chef_version |
| 34 | + chef.install = false # omnibus does it already |
| 35 | + chef.log_level = :info |
| 36 | + chef.add_recipe 'dkdeploy-php' |
| 37 | + chef.json = {} |
| 38 | + end |
| 39 | + |
| 40 | + # Memory limit and name of VirtualBox |
| 41 | + master_config.vm.provider 'virtualbox' do |virtualbox| |
| 42 | + virtualbox.name = domain |
| 43 | + virtualbox.gui = ENV['ENABLE_GUI_MODE'] && (ENV['ENABLE_GUI_MODE'] =~ /^(true|yes|y|1)$/i ? true : false) |
| 44 | + virtualbox.customize [ |
| 45 | + 'modifyvm', :id, |
| 46 | + '--natdnsproxy1', 'off', |
| 47 | + '--natdnshostresolver1', 'on', |
| 48 | + '--memory', '1024', |
| 49 | + '--name', 'dkdeploy-php' |
| 50 | + ] |
| 51 | + end |
| 52 | + end |
| 53 | + |
| 54 | + if Vagrant.has_plugin?('landrush') |
| 55 | + config.landrush.enabled = true |
| 56 | + config.landrush.guest_redirect_dns = false |
| 57 | + config.landrush.tld = 'dev' |
| 58 | + config.landrush.host domain, ip_address |
| 59 | + config.landrush.host domain_second, ip_address |
| 60 | + else |
| 61 | + config.vm.post_up_message = "Either install Vagrant plugin 'landrush' or add this entry to your host file: #{ip_address} #{domain} #{domain_second}" |
| 62 | + end |
| 63 | +end |
0 commit comments