Vagrant.configure("2") do |config| nodes.each do |node| config.vm.define node[:hostname] do |nodeconfig| nodeconfig.vm.box = "bento/ubuntu-16.04" nodeconfig.vm.hostname = node[:hostname] nodeconfig.vm.network :private_network, ip: node[:ip]
memory = node[:ram] ? node[:ram] : 512; nodeconfig.vm.provider :virtualbox do |vb| vb.customize [ "modifyvm", :id, "--memory", memory.to_s, ] if node[:osd] == "yes" vb.customize [ "createhd", "--filename", "disk_osd-# {node[:hostname]}", "--size", "10000" ] vb.customize [ "storageattach", :id, "--storagectl", "SATA Controller", "--port", 3, "--device", 0, "--type", "hdd", "--medium", "disk_osd-#{node[:hostname]}.vdi" ] end end end config.hostmanager.enabled = true config.hostmanager.manage_guest = true end end
Just in case if you encounter error in this step, you need to disable Hyper-V.
Run vagrant up to bring up the VMs defined in Vagrantfile:
Now let's connect to the ansible VM using ssh:
vagrant ssh ansible
The preceding command gives the following output:
If you are running Vagrant on Windows, the ssh command will inform you that you need to use an SSH client of your choice and provide the details to use it.
PuTTY would be a good suggestion for an SSH client. On Linux, the command will connect you straight onto the VM.
The username and password are both vagrant. After logging in, you should find yourself sitting at the Bash shell of the ansible VM:
Simply type exit to return to your host machine.
Congratulations! You have just deployed three servers for using as Ceph monitors, three servers for using as Ceph OSDs, and an Ansible server. Vagrantfile could have also contained extra steps to execute commands on the servers to configure them, but for now, let's shut down the servers using the following command; we can bring them back up for when needed by the examples later in this chapter: