Created
February 26, 2020 16:45
-
-
Save alfredodeza/1df1b474888bf9a89f08e98894293902 to your computer and use it in GitHub Desktop.
Handy vagrantfile for local VMs with some custom IP/CPU/ram mappings
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.ssh.insert_key = false | |
config.vm.synced_folder '.', '/vagrant', disabled: true | |
config.vm.define 'node1' do |node1| | |
node1.vm.box = "ceph/ubuntu-bionic" | |
node1.vm.network :private_network, :ip => "192.168.111.100" | |
node1.vm.host_name = "node1" | |
end | |
config.vm.define 'node2' do |node2| | |
node2.vm.box = "ceph/ubuntu-bionic" | |
node2.vm.network :private_network, :ip => "192.168.111.101" | |
node2.vm.host_name = "node2" | |
end | |
config.vm.define :node3 do |node3| | |
node3.vm.box = "centos/7" | |
node3.vm.network :private_network, :ip => "192.168.111.102" | |
node3.vm.host_name = "node3" | |
i = "node3" | |
#['scsi', 'sata', 'sas'].each_with_index do |name, count| | |
['scsi', 'sata'].each_with_index do |name, count| | |
node3.vm.provider :virtualbox do |vb| | |
vb.customize ['storagectl', :id, | |
'--name', "OSD Controller #{count}", | |
'--add', name] | |
(0..14).each do |d| | |
vb.customize ['createhd', | |
'--filename', "disk-#{name}-#{i}-#{d}", | |
'--size', '11000'] unless File.exist?("disk-#{name}-#{i}-#{d}.vdi") | |
vb.customize ['storageattach', :id, | |
'--storagectl', "OSD Controller #{count}", | |
'--port', d, | |
'--device', 0, | |
'--type', 'hdd', | |
'--medium', "disk-#{name}-#{i}-#{d}.vdi"] | |
end | |
end | |
end | |
end | |
config.vm.define :node4 do |node4| | |
node4.vm.box = "ceph/ubuntu-bionic" | |
node4.vm.network :private_network, :ip => "192.168.111.103" | |
node4.vm.host_name = "node4" | |
i = "node4" | |
node4.vm.provider :virtualbox do |vb| | |
vb.customize ['storagectl', :id, | |
'--name', 'OSD Controller', | |
'--add', 'scsi'] | |
(0..1).each do |d| | |
vb.customize ['createhd', | |
'--filename', "disk-#{i}-#{d}", | |
'--size', '11000'] unless File.exist?("disk-#{i}-#{d}.vdi") | |
vb.customize ['storageattach', :id, | |
'--storagectl', 'OSD Controller', | |
'--port', 3 + d, | |
'--device', 0, | |
'--type', 'hdd', | |
'--medium', "disk-#{i}-#{d}.vdi"] | |
end | |
end | |
end | |
config.vm.define :node5 do |node5| | |
node5.vm.box = "centos/7" | |
node5.vm.network "private_network", ip: "192.168.111.104" | |
end | |
config.vm.define :node6 do |node6| | |
node6.vm.box = "centos/7" | |
node6.vm.network :private_network, :ip => "192.168.111.105" | |
node6.vm.host_name = "node6" | |
end | |
config.vm.define :node7 do |node7| | |
node7.vm.box = "centos/7" | |
node7.vm.network :private_network, :ip => "192.168.111.106" | |
node7.vm.host_name = "node7" | |
# i = "node7" | |
# node7.vm.provider :virtualbox do |vb| | |
# vb.customize ['storagectl', :id, | |
# '--name', 'OSD Controller', | |
# '--add', 'scsi'] | |
# | |
# (0..1).each do |d| | |
# vb.customize ['createhd', | |
# '--filename', "disk-#{i}-#{d}", | |
# '--size', '11000'] unless File.exist?("disk-#{i}-#{d}.vdi") | |
# vb.customize ['storageattach', :id, | |
# '--storagectl', 'OSD Controller', | |
# '--port', 3 + d, | |
# '--device', 0, | |
# '--type', 'hdd', | |
# '--medium', "disk-#{i}-#{d}.vdi"] | |
# end | |
# end | |
end | |
config.vm.define :node8 do |node8| | |
node8.vm.box = "ceph/ubuntu-xenial" | |
node8.vm.host_name = "node8" | |
#node8.vm.box_url = "/Users/alfredo/Downloads/opscode_fedora-20_chef-provisionerless.box" | |
#node8.vm.box_url = "box-cutter/fedora22" | |
node8.vm.network :private_network, :ip => "192.168.111.107" | |
end | |
config.vm.define :node9 do |node9| | |
node9.vm.box = "ceph/ubuntu-xenial" | |
node9.vm.network :private_network, :ip => "192.168.111.108" | |
node9.vm.host_name = "node9" | |
i = "node9" | |
node9.vm.provider :virtualbox do |vb| | |
vb.customize ['storagectl', :id, | |
'--name', 'OSD Controller', | |
'--add', 'scsi'] | |
(0..8).each do |d| | |
vb.customize ['createhd', | |
'--filename', "disk-#{i}-#{d}", | |
'--size', '11000'] unless File.exist?("disk-#{i}-#{d}.vdi") | |
vb.customize ['storageattach', :id, | |
'--storagectl', 'OSD Controller', | |
'--port', 3 + d, | |
'--device', 0, | |
'--type', 'hdd', | |
'--medium', "disk-#{i}-#{d}.vdi"] | |
end | |
end | |
end | |
# Adjust cpus and ram | |
config.vm.provider :vritualbox do |vb| | |
vb.config.vm.customize ["modifyvm", :id, "--memory", "512"] | |
vb.customize ["modifyvm", :id, "--cpus", "4"] | |
end | |
#config.vm.provision :ansible do |ansible| | |
# # point Vagrant at the location of your playbook you want to run | |
# ansible.playbook = "./playbooks/setup-devserver.yml" | |
# #ansible.inventory_file = "./playbooks/hosts" | |
# # Increase the verbosity when ansible runs | |
# #ansible.options = "-vvv" | |
# # the Vagrant VM will be put in this host group change this should | |
# # match the host group in your playbook you want to test | |
# # If this doesn't match the action (e.g. you are running web-servers') | |
# # it will skip it | |
# # ansible.hosts = "dev-server" | |
#end | |
# | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment