Coder Social home page Coder Social logo

arnnow / puppet-libvirt Goto Github PK

View Code? Open in Web Editor NEW

This project forked from typhon-team/puppet-libvirt

0.0 1.0 0.0 85 KB

puppet module for libvirt

License: GNU General Public License v3.0

Ruby 38.14% Shell 7.75% Python 12.26% Puppet 33.96% HTML 7.88%

puppet-libvirt's Introduction

libvirt puppet module

Build Status Puppet Forge Puppet Forge Puppet Forge Puppet Forge

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. Reference
  5. Limitations - OS compatibility, etc.
  6. 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 can 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,
}

Add some libvirtd options:

class { '::libvirtd':
    default_conf => {
        'libvirtd_opts' => '-d -l'
    }
}

Configure libvirtd settings in libvirtd.conf file:

class { '::libvirtd':
    libvirtd_conf => {
        'listen_tcp' => 1,
        'tcp_port'   => 16509,
    }
}

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

Reference

Functions

libvirt_generate_mac

Returns a MAC address in the QEMU/KVM MAC OID (52:54:00:...)

libvirt_generate_mac_addresses

Generates MAC addresses for all interfaces in the array which do not yet have an address specified. The MAC addresses are based on the domain name, network and portgroup.

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.

Contributing

Please report bugs and feature request using GitHub issue tracker.

For pull requests, it is very much appreciated to check your Puppet manifest with puppet-lint and the available spec tests in order to follow the recommended Puppet style guidelines from the Puppet Labs style guide.

puppet-libvirt's People

Contributors

trefzer avatar gaudenz avatar maxenced avatar gioodev avatar iainhallam avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.