-
Notifications
You must be signed in to change notification settings - Fork 29
Vagrant and Libvirt plugin for @scale deployment
- "Vagrant - the command line utility for managing the life-cycle of virtual machines." (version: 1.9.2)
- Vagrant-libvirt plugin add a provider to Vagrant which allowing Vagrant to control and provision machines via libvirt toolkit. (version 1.3.1)
- Vagrant up, destroy, suspend, resume, halt, ssh, reload, package and provision commands.
Here we select a VM with Ubuntu 16.04 installed as Vagrant host server.
- Vagrant host Environment Preparation:
-
Install Vagrant dependency
$ sudo apt-get install ruby-full
$ sudo apt install ruby-bundler
$ git clone https://github.com/mitchellh/vagrant.git
$ cd vagrant
$ bundle install
-
Install latest version vagrant from https://www.vagrantup.com/downloads.html
$ wget https://releases.hashicorp.com/vagrant/1.9.2/vagrant_1.9.2_x86_64.deb
$ sudo dpkg -i vagrant_1.9.2_x86_64.deb
$ vagrant --version "to make sure Vagrant version as your expectation"
-
Need to make sure your have all the build dependencies (in Ubuntu) installed for vagrant-libvirt.
** Uncomment "deb-src" sources in "/etc/apt/sources.list"**
> $ sudo apt-get update
> $ apt-get build-dep vagrant ruby-libvirt
> $ sudo apt-get install qemu-kvm libvirt-bin libvirt-dev
> $ sudo apt-get install qemu libvirt-bin ebtables dnsmasq
> $ sudo apt-get install libxslt-dev libxml2-dev libvirt-dev zlib1g-dev ruby-dev
> $ sudo adduser $USER libvirtd
-
Need to install vagrant-libvirt use standard vagrant plugin installation method.
$ vagrant plugin install vagrant-libvirt
$ vagrant plugin list
vagrant-libvirt (0.0.37)
Packer build templates found in chef/bento github repo..
$ git clone https://github.com/chef/bento
$ cd bento
$ packer build -only qemu -var "headless=true" ubuntu-14.04.amd64.json
$ vagrant box add builds/ubuntu-14.04.libvirt.box --name "InfraSIM"
$ vagrant box list
InfraSIM (libvirt, 0)
InfraSIM-Ubuntu-1604 (libvirt, 0)
**While building your box using packer, ubuntu-14.04-amd64-libvirt-box is recommended. **
Please prepare this file base on provider info, an example is uploaded to GitHub InfraSIM/tools/@scale repo for reference. https://github.com/InfraSIM/tools
$ vagrant up --provider=libvirt
$ virsh list
$ vagrant ssh vagrant-1
$ vagrant destroy
After all InfraSIM virtual nodes powered up, you can refer to Ansible playbook in InfraSIM/tools repo for further operation on InfraSIMs.
https://github.com/InfraSIM/tools/pull/40
If add "--debug" parameter we can save output to a file "vagrant.log".
$ vagrant up --debug &> vagrant.log
https://www.vagrantup.com/docs/
https://github.com/mitchellh/vagrant
https://github.com/vagrant-libvirt/vagrant-libvirt