增加特定 vagrant box 的内存
Increase memory of a particular vagrant box
我有这个 Vagrantfile。在这里,我将所有 VM 的内存定义为 2048。但是我想让我的傀儡师有 4096,特工有 2048。怎么办?
Vagrant.configure("2") do |config|
config.vm.synced_folder ".", "/vagrant", type: "virtualbox"
config.vm.provider "virtualbox" do |v|
v.memory = 2048
v.cpus = 2
end
config.vm.define "puppetmaster" do |pm|
pm.vm.box = "centos/7"
pm.vm.network "private_network", ip: "192.168.33.10"
pm.vm.hostname = "puppetmaster"
end
config.vm.define "puppet-agent-centos" do |pac|
pac.vm.box = "centos/7"
pac.vm.network "private_network", ip: "192.168.33.11"
pac.vm.hostname = "centos-agent"
end
config.vm.define "puppet-agent-ubuntu" do |pau|
pau.vm.box = "ubuntu/xenial64"
pau.vm.network "private_network", ip: "192.168.33.12"
pau.vm.hostname = "ubuntu-agent"
end
end
谢谢!
您可以通过覆盖特定 VM 的值轻松做到这一点
config.vm.define "puppetmaster" do |pm|
pm.vm.box = "centos/7"
pm.vm.network "private_network", ip: "192.168.33.10"
pm.vm.hostname = "puppetmaster"
pm.vm.provider "virtualbox" do |pmv|
pmv.memory = 4096
end
end
所以你的整个文件变成
Vagrant.configure("2") do |config|
config.vm.synced_folder ".", "/vagrant", type: "virtualbox"
config.vm.provider "virtualbox" do |v|
v.memory = 2048
v.cpus = 2
end
config.vm.define "puppetmaster" do |pm|
pm.vm.box = "centos/7"
pm.vm.network "private_network", ip: "192.168.33.10"
pm.vm.hostname = "puppetmaster"
pm.vm.provider "virtualbox" do |pmv|
pmv.memory = 4096
end
end
config.vm.define "puppet-agent-centos" do |pac|
pac.vm.box = "centos/7"
pac.vm.network "private_network", ip: "192.168.33.11"
pac.vm.hostname = "centos-agent"
end
config.vm.define "puppet-agent-ubuntu" do |pau|
pau.vm.box = "ubuntu/xenial64"
pau.vm.network "private_network", ip: "192.168.33.12"
pau.vm.hostname = "ubuntu-agent"
end
end
我有这个 Vagrantfile。在这里,我将所有 VM 的内存定义为 2048。但是我想让我的傀儡师有 4096,特工有 2048。怎么办?
Vagrant.configure("2") do |config|
config.vm.synced_folder ".", "/vagrant", type: "virtualbox"
config.vm.provider "virtualbox" do |v|
v.memory = 2048
v.cpus = 2
end
config.vm.define "puppetmaster" do |pm|
pm.vm.box = "centos/7"
pm.vm.network "private_network", ip: "192.168.33.10"
pm.vm.hostname = "puppetmaster"
end
config.vm.define "puppet-agent-centos" do |pac|
pac.vm.box = "centos/7"
pac.vm.network "private_network", ip: "192.168.33.11"
pac.vm.hostname = "centos-agent"
end
config.vm.define "puppet-agent-ubuntu" do |pau|
pau.vm.box = "ubuntu/xenial64"
pau.vm.network "private_network", ip: "192.168.33.12"
pau.vm.hostname = "ubuntu-agent"
end
end
谢谢!
您可以通过覆盖特定 VM 的值轻松做到这一点
config.vm.define "puppetmaster" do |pm|
pm.vm.box = "centos/7"
pm.vm.network "private_network", ip: "192.168.33.10"
pm.vm.hostname = "puppetmaster"
pm.vm.provider "virtualbox" do |pmv|
pmv.memory = 4096
end
end
所以你的整个文件变成
Vagrant.configure("2") do |config|
config.vm.synced_folder ".", "/vagrant", type: "virtualbox"
config.vm.provider "virtualbox" do |v|
v.memory = 2048
v.cpus = 2
end
config.vm.define "puppetmaster" do |pm|
pm.vm.box = "centos/7"
pm.vm.network "private_network", ip: "192.168.33.10"
pm.vm.hostname = "puppetmaster"
pm.vm.provider "virtualbox" do |pmv|
pmv.memory = 4096
end
end
config.vm.define "puppet-agent-centos" do |pac|
pac.vm.box = "centos/7"
pac.vm.network "private_network", ip: "192.168.33.11"
pac.vm.hostname = "centos-agent"
end
config.vm.define "puppet-agent-ubuntu" do |pau|
pau.vm.box = "ubuntu/xenial64"
pau.vm.network "private_network", ip: "192.168.33.12"
pau.vm.hostname = "ubuntu-agent"
end
end