Last active
January 17, 2020 02:24
-
-
Save hotta/11692a47a921615b43872f3ffac2d8a6 to your computer and use it in GitHub Desktop.
Vagrantfile with multiple NICs and additional storage enabled
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure("2") do |config| | |
config.vm.box = "centos/7" | |
config.vm.network "private_network", ip: "192.168.56.13" | |
config.vm.network "private_network", ip: "172.16.32.4" | |
config.vm.network "private_network", ip: "172.16.0.7" | |
config.vm.hostname = "db2" | |
config.vm.synced_folder ".", "/vagrant", disabled: true | |
config.vm.network :forwarded_port, guest: 22, host: 2213 | |
config.vm.provider "virtualbox" do |vb| | |
vb.memory = "2048" | |
file_to_disk = "D:/vm/optional-storage/db2-disk2.vdi" | |
vb.customize [ | |
'modifyvm', :id, | |
'--natdnshostresolver1', 'on' | |
] | |
unless File.exists?(file_to_disk) | |
vb.customize [ | |
'createhd', | |
'--filename', file_to_disk, | |
'--format', 'VDI', | |
'--size', 1024 | |
] | |
vb.customize [ | |
'storageattach', :id, | |
'--storagectl', 'IDE', | |
'--port', 1, | |
'--device', 0, | |
'--type', 'hdd', | |
'--medium', file_to_disk | |
] | |
end | |
end | |
config.vm.provision "shell", inline: <<-SHELL | |
sudo yum -y update | |
sudo yum -y install git epel-release | |
sudo yum -y install ansible | |
SHELL | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment