Forge Home

libvirt

DEPRECATED: Puppet module to install libvirt and create virtual domain configuration

14,354 downloads

6,179 latest version

4.0 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 1.4.2 (latest)
  • 1.4.1
  • 1.4.0
  • 1.3.0
  • 1.2.0
  • 1.1.2
  • 1.1.1
  • 1.1.0
  • 1.0.0
released Feb 14th 2018
This version is compatible with:
  • ,
This module has been deprecated by its author since May 14th 2020.

The author has suggested cirrax-libvirt as its replacement.

Start using this module

Documentation

gaudenz/libvirt — version 1.4.2 Feb 14th 2018

Deprecation warning

This module moved to cirrax-libvirt.

I'm no longer actively maintaining it, but my colleagues at Cirrax still use it and moved it to their namespace.

libvirt

Table of Contents

  1. Overview
  2. Module Description - What the module does and why it is useful
  3. Usage - Configuration options and additional functionality
  4. Limitations - OS compatibility, etc.
  5. Development - Guide for contributing to the module

Overview

Puppet module to install libvirt and create virtual domain configuration. This module has very minimal external dependencies and tries to not make any assumptions about how you want to setup your virtual machines.

The module contains helper scripts to manage VMs on a 2 node cluster with disk replication over DRBD. But this is completely optional.

Description

This module tries to adhere to the Unix philosophy of doing one thing but doing it right. It installs and configures libvirt and virtual domains, but does not do the basic setup of your networking bridge or configure the disks used by the virtual domains. This is left to other puppet modules.

For a basic setup you have to include the libvirt class, define a libvirt::network and a libvirt::domain.

As an optional add-on this module contains a libvirt hook and a Python management script to create a 2 node cluster with disks replicated over DRBD. This setup allows live migration of VMs from one node to the other.

A complete working solution ca be achived by integrating the following modules in addition to this module:

Usage

Install libvirt:

class {'libvirt': }

Install including the DRBD hook:

class {'libvirt':
  qemu_hook => 'drbd',
}

Define a network (basic linux bridge example):

libvirt::network { 'net-simple':
    forward_mode   => 'bridge',
    bridge         => 'br-simple',
}

Define a network (advanced openvswitch example):

libvirt::network { 'net-ovs':
  forward_mode     => 'bridge',
  bridge           => 'br-ovs',
  virtualport_type => 'openvswitch',
  autostart        => true,
  portgroups       => [
                       {'name'     => 'intern',
                        'trunk'    => false,
                        'vlan_tag' => '2',
                        },
                       {'name'     => 'trunk',
                        'trunk'    => true,
                        'vlan_tag' => ['100', '101', '102', ],
                        },
                       ],
}

Define a domain (VM):

libvirt::domain { 'my-domain':
  max_memory     => '2000',
  cpus           => 2,
  boot           => 'hd',
  disks          => [{'type' => 'block',
                      'device' => 'disk',
                      'source' => {'dev' => '/dev/vm-pool/my-domain.img'},
                      },
                     {'type'   => 'file',
                      'device' => 'disk',
                      'source' => {'dev' => '/var/lib/libvirt/images/my-disk.qcow2'},
                      'bus'    => 'virtio',
                      'driver' => {'name'  => 'qemu',
                                   'type'  => 'qcow2',
                                   'cache' => 'none',
                                   },
                     ],
  interfaces     => [{'network' => 'net-simple'},],
  autostart      => true,
}

Complete documentation is included in puppet doc format in the manifest files.

Limitations

Things currently not supported:

  • Operating Systems other than Debian or RedHat. Adding support for other systems is a matter of defining the relevant parameters in params.pp. So this is really easy for someone with access to such a system.
  • libvirt storage pools
  • Network interfaces not attached to a libvirt network

Patches to support any of these (or other) missing features are welcome.

Development

Contributions are welcome. Please send pull request or patches to gaudenz.steinlin@cirrax.com.

Browse source code: http://git.cirrax.com/?p=puppet-modules/libvirt.git

Clone repository: git clone git://git.cirrax.com/puppet-modules/libvirt.git