====== Vagrant ====== https://ttboj.wordpress.com/2013/12/09/vagrant-on-fedora-with-libvirt/ http://blog.gluster.org/category/libvirt/ http://garylarizza.com/blog/2013/02/01/repeatable-puppet-development-with-vagrant/ ===== Boxes ===== * https://vagrantcloud.com/puppetlabs * http://opscode-vm-bento.s3.amazonaws.com/ * vagrant/vmware/opscode_debian-7.8-i386_chef-provisionerless.box ===== Installation ===== https://github.com/adrahon/vagrant-kvm/wiki/Install_on_Fedora sudo yum -y install qemu-kvm libvirt libvirt-daemon-kvm libvirt-devel redir policycoreutils-python sudo yum -y install gcc-c++ make libtool sudo yum -y install gcc-c++ make libtool git libxml2-devel libxslt-devel sudo yum -y install ruby-devel rubygems rubygem-rake rvm yum -y install vagrant vagrant plugin install vagrant-kvm # install older version vagrant plugin install vagrant-kvm --plugin-version=0.1.7 There are some problems: gem source not found: sudo gem update --system vagrant Storage source conflict with pool: ===== Download Box ===== There are kvm boxes here: https://github.com/adrahon/vagrant-kvm/wiki/List-boxes vagrant box add trusty64 https://vagrant-kvm-boxes-si.s3.amazonaws.com/trusty64-kvm-20140418.box vagrant box list trusty64 (kvm, 0) ===== Convert Box ===== vagrant plugin install vagrant-mutate vagrant mutate trusty64 kvm/libvirt vagrant box list saucy64 (virtualbox, 0) trusty64 (kvm, 0) ===== Vagrant File ===== ===== Run VM ===== vagrant up --provider=kvm vagrant ssh trusty64 Set default provider: export VAGRANT_DEFAULT_PROVIDER=kvm ===== Useful Plugins ===== ==== Reload Plugin ==== To reboot VMs during provisioning, e.g, yum update kernel, reboot. vagrant plugin install vagrant-reload ==== Sahara ==== Once you finish vagrant up for the very first time, consider using Vagrant Sahara so you do not have to wait long in order to get a clean set of openstack nodes. To install that plugin, all you need is: vagrant plugin install sahara The command to get a sahara sandbox setup is: vagrant sandbox on The command to get the vms back to the time when you did vagrant sandbox on is: vagrant sandbox rollback ==== Package ==== In order to not have to run the installations all the time we'll create a package vagrant package --output node-vim-dotfiles.box Add it so we can use it in future Vagrantfiles vagrant box add node-vim-dotfiles.box --name node-vim-dotfiles Libvirt boxes need vagrant-cachier vagrant plugin install vagrant-cachier ==== Vagrant-Cachier ==== The easiest way to set things up is just to enable cache buckets auto detection from within your Vagrantfile: Vagrant.configure("2") do |config| config.vm.box = 'your-box' if Vagrant.has_plugin?("vagrant-cachier") # Configure cached packages to be shared between instances of the same base box. # More info on the "Usage" link above config.cache.scope = :box # OPTIONAL: If you are using VirtualBox, you might want to use that to enable # NFS for shared folders. This is also very useful for vagrant-libvirt if you # want bi-directional sync config.cache.synced_folder_opts = { type: :nfs, # The nolock option can be useful for an NFSv3 client that wants to avoid the # NLM sideband protocol. Without this option, apt-get might hang if it tries # to lock files needed for /var/cache/* operations. All of this can be avoided # by using NFSv4 everywhere. Please note that the tcp option is not the default. mount_options: ['rw', 'vers=3', 'tcp', 'nolock'] } end end Cachier create a cache folder: /tmp/vagrant-cache/ on VM, which is nfs-ed to ~/.vagrant.d/cache on host. === Trick to cache maven artifact === There are two locations where a settings.xml file may live: The Maven install: $M2_HOME/conf/settings.xml A user’s install: ${user.home}/.m2/settings.xml Look for the effective global settings.xml mvn help:effective-settings Change local repo mkdir -p /tmp/vagrant-cache/maven yum -y install maven xmlstarlet xmlstarlet ed -L -s "/_:settings" -t elem -n "localRepository" -v "/tmp/vagrant-cache/maven" /etc/maven/settings.xml **Note** when using both mvn and eclipse, it's better to make a symlink from .m2/reposity to external folder. ==== vagrant-systemd ==== Support Guest with systemd vagrant plugin install vagrant-systemd ===== Puppet ===== ==== Reload puppet provision ==== vagrant reload odl-dev --provision === Testing Vagrant puppet modules on VM === The host puppet directory will be copied to /tmp/vagrant-puppet-5/manifests/. To apply this we need to pass the modules, manifest parameter to puppet when calling it on manifest_file.pp. The related parameters are puppet.working_directory, manifest_path, module_path, manifest_file, hiera_config_path. puppet apply --noop --debug \ --modulepath /tmp/vagrant-puppet-5/modules-0 \ /tmp/vagrant-puppet-5/manifests/odl-dev.pp --confdir /tmp/vagrant-puppet-5 ??? **Note**: Puppet master should default to confdir of ~/.puppet and vardir of ~/.puppet/var when running as non-root, instead defaults to /etc/puppet and /var/lib/puppet respectively. ===== Troubleshooting ===== * https://github.com/pradels/vagrant-libvirt/issues/282 ==== Install vagrant from source ==== git clone gem install bundler --version '<1.8.0' Download bundler install rm -r ~/.vagrant.d/plugins.json ~/.vagrant.d/gems Note if you have an alternate VAGRANT_HOME environmental variable set, the folders above will be in that directory rather than your user's home directory. ====== Install Vagrant from source ====== You can install from source to get the bleeding edge of Vagrant. Clone the git repository out into any directory. git clone https://github.com/mitchellh/vagrant.git If you don't have it installed yet, you'll need bundler ( http://bundler.io/ ): sudo gem install bundler Then, install the gem. bundle install sudo rake install The dev version will now become the active Vagrant version. If you want to switch back to the previously active version, simply uninstall the dev version. gem uninstall vagrant Choose to remove the ".dev" version.