diff --git a/contrib/ansible/vagrant/README.md b/contrib/ansible/vagrant/README.md index ad9ce895274..d225d4af2d0 100644 --- a/contrib/ansible/vagrant/README.md +++ b/contrib/ansible/vagrant/README.md @@ -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. diff --git a/contrib/ansible/vagrant/Vagrantfile b/contrib/ansible/vagrant/Vagrantfile index 3bff56c00bd..b39ec415851 100644 --- a/contrib/ansible/vagrant/Vagrantfile +++ b/contrib/ansible/vagrant/Vagrantfile @@ -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