Home

Awesome

Fork notes

This fork focuses on features and fixes for Qemu VMs.

Some optimisations, to avoid so many requests to the node for a list of every VM.

This fork fixes issues to work in our environment, but likely breaks features that we are not using ourselves.

If you are not using Proxmox and Qemu, this fork is probably not for you.

Installing this plugin from source

Install any required Ruby gems: sudo bundle install

Build the gem from source: gem build vagrant-proxmox.gemspec

Install the proxmox vagrant plugin gem: vagrant plugin install ./vagrant-proxmox-0.3.0.gem

If you make local changes to code a quick-and-dirty way to deploy that for testing: rsync -av /home/USERNAME/vagrant-proxmox/lib/ /home/USERNAME/.vagrant.d/gems/2.7.6/gems/vagrant-proxmox-0.3.0/lib/ Where /home/USERNAME/vagrant-proxmox/ is the location of the code.

Vagrant Proxmox Provider

This is a Vagrant plugin that adds a Proxmox provider to Vagrant, allowing Vagrant to manage and provision Proxmox virtual machines.

Features

Limitations

Requirements

Installation

Install using standard Vagrant plugin method:

$ vagrant plugin install vagrant-proxmox

This will install the plugin from RubGems.org.

Usage

First install the provided dummy vagrant box:

$ vagrant box add dummy dummy_box/dummy.box

Then for an openvz container create a Vagrantfile that looks like the following (note that you might have to add "@pam" to your username if you're getting a "401 Unauthorized" error):

Vagrant.configure('2') do |config|

    config.vm.provider :proxmox do |proxmox|
        proxmox.endpoint = 'https://your.proxmox.server:8006/api2/json'
        proxmox.user_name = 'proxmox_username@pam'
        proxmox.password = 'proxmox_password'
        proxmox.vm_id_range = 900..910
        proxmox.vm_name_prefix = 'vagrant_'
        proxmox.openvz_os_template = 'local:vztmpl/vagrant-proxmox-ubuntu-12.tar.gz'
        proxmox.vm_type = :openvz
        proxmox.vm_memory = 256
    end

    config.vm.define :box, primary: true do |box|
        box.vm.box = 'dummy'
        box.vm.network :public_network, ip: '192.168.0.1'
    end

end

You can change the proxmox.vm_type = :openvz line to proxmox.vm_type = :lxc to use lxc instead of openvz

If you want KVM the Vagrantfile could look as follows:

Vagrant.configure('2') do |config|

    config.vm.provider :proxmox do |proxmox|
        proxmox.endpoint = 'https://proxmox.example.com/api2/json'
        proxmox.user_name = 'vagrant'
        proxmox.password = 'password'
        proxmox.vm_id_range = 900..910
        proxmox.vm_type = :qemu
        proxmox.vm_name_prefix = 'vagrant_'
        proxmox.qemu_os = :l26
        proxmox.qemu_disk_size = '30G'
        proxmox.qemu_storage = 'local'
        proxmox.qemu_iso_file = '/home/user/system.iso'
        proxmox.vm_name_prefix = 'vagrant_test_'
        proxmox.qemu_cores = 1
        proxmox.qemu_sockets = 1
        proxmox.qemu_nic_model = 'virtio'
        proxmox.qemu_bridge = 'vmbr0'
        proxmox.vm_memory = 512
        # place new container / vm into pool 'vagrant'
        proxmox.pool = 'vagrant'
    end

    config.vm.define :box, primary: true do |box|
        box.vm.box = 'dummy'
        box.vm.network :public_network, ip: '192.168.0.1', macaddress: 'ff:aa:cc:dd:bb:ee'
    end

end

For the meaning of the various options, refer to the Options section below.

You need an OpenVZ template or KVM ISO that contains a vagrant user supplied with the default Vagrant SSH keys. You can download an example Ubuntu based template here.

Finally run vagrant up --provider=proxmox to create and start the new OpenVZ container.

Options

Debug RestClient Communication with Proxmox-Node

vagrant-proxmox uses Rest-Client gem to communicate with proxmox.

$ RESTCLIENT_LOG=stdout vagrant up --provider proxmox

Tips

Build the plugin

Build the plugin gem with

$ rake build

Optionally run the rspec tests with

$ rake spec

About us

TELCAT MULTICOM GmbH is a Germany-wide system house for innovative solutions and services in the areas of information, communication and security technology.

We develop IP-based telecommunication systems (TELCAT-UC) and use Vagrant and Proxmox to automatically deploy and test the builds in our Jenkins jobs.