61 lines
1.6 KiB
Ruby
61 lines
1.6 KiB
Ruby
|
Vagrant.configure('2') do |config|
|
||
|
|
||
|
# configure box to use host http_proxy if
|
||
|
# vagrant-proxyconf is enabled
|
||
|
def configure_proxy(vm_def)
|
||
|
if Vagrant.has_plugin?("vagrant-proxyconf") && ENV['http_proxy']
|
||
|
vm_def.proxy.http = ENV['http_proxy']
|
||
|
vm_def.proxy.https = ENV['https_proxy']
|
||
|
vm_def.apt_proxy.http = ENV['http_proxy']
|
||
|
vm_def.apt_proxy.https = ENV['https_proxy']
|
||
|
vm_def.proxy.no_proxy = ENV['no_proxy']
|
||
|
end
|
||
|
end
|
||
|
|
||
|
DEFAULT_VAGRANT_BOX = 'rubicon/ubuntu1404-salt'
|
||
|
|
||
|
def set_box(vm_def)
|
||
|
vm_def.vm.box = ENV['VAGRANT_BOX'] || DEFAULT_VAGRANT_BOX
|
||
|
if ENV['VAGRANT_BOX_VERSION']
|
||
|
vm_def.vm.box_version = ENV['VAGRANT_BOX_VERSION']
|
||
|
vm_def.vm.box_check_update = false
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def configure_vm_size(vm_def)
|
||
|
if ENV['VAGRANT_VM_MEM']
|
||
|
vm_def.vm.provider 'virtualbox' do |vb|
|
||
|
vb.memory = ENV['VAGRANT_VM_MEM']
|
||
|
end
|
||
|
end
|
||
|
if ENV['VAGRANT_VM_CPU']
|
||
|
vm_def.vm.provider 'virtualbox' do |vb|
|
||
|
vb.cpus = ENV['VAGRANT_VM_CPU']
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
config.vm.define :sudoers01 do |sudoers01|
|
||
|
|
||
|
configure_proxy(sudoers01)
|
||
|
set_box(sudoers01)
|
||
|
configure_vm_size(sudoers01)
|
||
|
|
||
|
sudoers01.vm.hostname = 'sudoers01'
|
||
|
sudoers01.vm.synced_folder 'roots/salt', '/srv/salt'
|
||
|
sudoers01.vm.synced_folder 'roots/pillar', '/srv/pillar'
|
||
|
sudoers01.vm.synced_folder '../sudoers', '/srv/salt/sudoers'
|
||
|
|
||
|
sudoers01.vm.provision :salt do |salt|
|
||
|
salt.minion_config = 'minion'
|
||
|
salt.run_highstate = true
|
||
|
salt.verbose = true
|
||
|
|
||
|
if ENV['salt_install_args']
|
||
|
salt.install_args = ENV['salt_install_args']
|
||
|
end
|
||
|
|
||
|
end
|
||
|
end
|
||
|
end
|