I have this Vagrantfile. Here I defined the memory to be 2048 for all VMs. But I want my puppet master to have 4096 and agents to have 2048. How to do that?
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
Thanks!
Increase Memory and CPU on Vagrant machine from commandlineDefine the RAM size and CPU count like below. As per the above configuration, I have defined 2 GB RAM and 2 CPU core to my Vagrant machine. Make sure you have added these lines before the last "end" line. Press ESC key, and type :wq to save the file and exit.
Provisioners in Vagrant allow you to automatically install software, alter configurations, and more on the machine as part of the vagrant up process. This is useful since boxes typically are not built perfectly for your use case.
You can easily do that by overriding the value for a specific 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
so your whole file becomes
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With