3. Usefulness of Vagrant
➔ For Developers
Say goodbye to "works on my machine"
bugs.
➔ For Operators
stop juggling SSH prompts to various
machines, and start using Vagrant to
bring sanity to your life.
➔ For Designers
No more bothering other developers to
help you fix your environment so you can
test designs.
6. Hypervisor 간의 충돌
➔ VirtualBox VS. KVM
echo ‘blacklist kvm-intel’ >>
/etc/modprobe.d/blacklist.conf
➔ VirtualBox VS. Hyper-V
Disable-WindowsOptionalFeature
-Online -FeatureName
Microsoft-Hyper-V-All
➔ Create the VM using 64-bit OS
enable the VT-D option in BIOS
9. config.vm #2 : provider
● What is Provider?
● supported : VirtualBox, Hyper-V,
VMware, Docker and Custom
Provider
config.vm.provider "virtualbox" do |v|
v.gui = true
v.name = "my_vm"
v.default_nic_type = "82543GC"
v.linked_clone = true if
Gem::Version.new(Vagrant::VERSION) >=
Gem::Version.new('1.8.0')
v.customize ["modifyvm", :id,
"--cpuexecutioncap", "50"]
v.memory = 1024
v.cpus = 2
end
10. config.vm #3 : network
● Private or Public
● NAT or Bridge or Host-only
Vagrant.configure("2") do |config|
config.vm.network "private_network", type: "”, ip: "”,
netmask: "”, auto_config: "”, virtualbox__intnet: "”,
nic_type: "”
end
Vagrant.configure("2") do |config|
config.vm.network "public_network", ip: "”,
netmask: "”, auto_config: "”,
use_dhcp_assigned_default_route: "”, bridge: "”,
nic_type: "”
end
11. config.vm #4 :
synced_folder
● Very convenient function
● Share between Host Machine and
Guest Machine
Vagrant.configure("2") do |config|
config.vm.synced_folder “/home”, “/dev”
end
→ Guest Machine
/vagrant
12. config.vm #5 :
provision
● When is occured the
provisioning?
● execute shell script, ansible, chef,
puppet, salt and docker
● Once or Always or Never
Vagrant.configure("2") do |config|
config.vm.provision "shell", inline: "echo hello”, run:
"always”
end
Vagrant.configure("2") do |config|
config.vm.provision "bootstrap", type: "shell”, run:
"never” do |s|
s.inline = “echo hello”
end