Ansible: Vagrant: Add libvirt support

This commit is contained in:
Eric Paris
2015-07-13 18:40:08 -04:00
parent 51a33d3ff5
commit ce4d2d41fb
2 changed files with 23 additions and 1 deletions

View File

@@ -4,7 +4,7 @@ This deployer sets up a vagrant cluster and installs kubernetes with flannel on
## Before you start !
You will need a functioning vagrant provider. Currently supported are openstack and virtualbox.
You will need a functioning vagrant provider. Currently supported are openstack, libvirt, and virtualbox.
## USAGE
@@ -44,6 +44,15 @@ To use the vagrant openstack provider you will need
For vagrant (1.7.2) does not seem to ever want to pick openstack as the provider. So you will need to tell it to use openstack explicitly.
###### Libvirt
The libvirt vagrant provider is non-deterministic when launching VMs. This is a problem as we need ansible to only run after all of the VMs are running. To solve this when using libvirt one must
do the following
```
vagrant up --no-provision
vagrant provision
```
### VirtualBox
Nothing special with VirtualBox. Hopefully `vagrant up` just works.

View File

@@ -70,6 +70,15 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
vb.customize ["modifyvm", :id, "--nictype2", "virtio"]
end
def set_libvirt(lv, config)
config.vm.box = "kube-centos-7"
config.vm.box_url = "http://cloud.centos.org/centos/7/vagrant/x86_64/images/CentOS-7.LibVirt.box"
lv.memory = 2048
lv.cpus = 2
lv.nested = true
lv.volume_cache = 'none'
end
def set_provider(n)
n.vm.provider :openstack do |os, override|
set_openstack(os, override, n)
@@ -77,6 +86,10 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
n.vm.provider :virtualbox do |vb, override|
set_vbox(vb, override)
end
n.vm.provider :libvirt do |lv, override|
set_libvirt(lv, override)
end
end
config.vm.synced_folder ".", "/vagrant", disabled: true