Puppet Forge

PuppetForge 0.4.0

Module puppetlabs/opennebula 0.0.1

Module description

This module manages OpenNebula from within Puppet.

Overview

This is the OpenNebula module. Here we are providing capability within Puppet to install and configure your OpenNebula clusters.

Disclaimer

Warning! While this software is written in the best interest of quality it has not been formally tested by our QA teams. Use at your own risk, but feel free to enjoy and perhaps improve it while you do.

Please see the included Apache Software License for more legal details regarding warranty.

Requirements

So this module was predominantly tested on:

  • Puppet 2.7.0rc4
  • Debian Wheezy
  • OpenNebula 2.0.1

Other combinations may work, and we are happy to obviously take patches to support other stacks.

Installation

As with most modules, its best to download this module from the forge:

http://forge.puppetlabs.com/puppetlabs/opennebula

If you want the bleeding edge (and potentially broken) version from github, download the module into your modulepath on your Puppetmaster. If you are not sure where your module path is try this command:

puppet --configprint modulepath

Depending on the version of Puppet, you may need to restart the puppetmasterd (or Apache) process before the functions will work.

This module uses both Ruby based providers, functions and it also relies on exported resources. Configuration must include the following items:

[master]
storeconfigs = true
thin_storeconfigs = true
dbadapter = mysql
dbuser = puppet
dbpassword = password
dbserver = localhost

And for the agent:

[agent]
pluginsync = true

The module will not operate normally without these features.

Quick Start

Setup the controller.

node "oneserver" {
  class { "opennebula::controller":
    oneadmin_password => "mypassword",
  }
}

Setup a node.

node "kvm1" {
  # You will need to configure libvirt and kvm (for example)
  class { "kvm":
  }
  class { "libvirt":
  }

  class { "opennebula::node": 
    controller => "oneserver",
  }
}

Setup an econe server:

node "econe1" {
  class { "opennebula::econe":
    one_xmlrpc => "http://oneserver:2633/RPC2",
  }
}

Setup up the Sunstone web interface:

node "controller1":
  class { "opennebula::sunstone": }
}

This will be available on http://$fqdn:4568/.

Detailed Usage

Class based versus resource based

The module is designed to allow you to configure everything during class instantiation time or configure elements later using individual resources.

Classes

opennebula::controller

This class is responsible for setting up the main ‘controller’ node where oned runs.

This class can also be passed parameters to configure most aspects of OpenNebula:

  • Networks
  • Clusters
  • Hosts
  • Images
  • Virtual Machines

Examples

Basic example:

class { "opennebula::controller":
  oneadmin_password => "mypassword",
}

Configuring clusters, networks and hosts all at the same time:

class { "opennebula::controller":
  oneadmin_password => "mypassword",
  networks => {
    "net1" => {
      type => "ranged",
      public => false,
      bridge => "vlan24",
      network_size => "C",
      network_address => "192.168.45.0",
    }
  },
  hosts => {
    "node1" => {
      im_mad => "im_kvm",
      tm_mad => "tm_ssh",
      vm_mad => "vmm_kvm",
    }
  }
  clusters => [ "smallboxes", "bigboxes" ],
}

Configuring a different storage backend:

class { "opennebula::controller":
  oneadmin_password => "something",
  oned_config => {
    'db_backend' => 'mysql',
    'db_server' => 'localhost',
    'db_user' => 'opennebula',
    'db_passwd' => 'opennebula',
    'db_name' => 'opennebula',
  },
}

Adding hooks for dynamic DNS can be done using the oned_config->hooks parameter area.

This allows you to have Opennebula automatically update DNS when nodes are created and remove DNS entries when nodes are destroyed:

class { "opennebula::controller":
  oneadmin_password => "something",
  oned_config => {
    hooks => {
      'dnsupdate' => {
        on => "running",
        command => "/usr/share/one/hooks/puppet/dnsupdate.rb",
        arguments => 'vms.cloud.mydomain.com 1.1.1.1 $NAME $NIC[IP]',
        remote => "no",
      },
      'dnsdelete' => {
        on => "done",
        command => "/usr/share/one/hooks/puppet/dnsdelete.rb",
        arguments => 'vms.cloud.mydomain.com 1.1.1.1 $NAME',
        remote => "no",
      },
    },
  },
}

opennebula::node

This class should be included on nodes that are designed to run virtual machines for the OpenNebula cluster.

You have to specify a controller for the node to peer with.

Examples

Basic example:

class { "opennebula::node":
  controller => "one1.mydomain.com",
}

opennebula::econe

This class is for configuring the OpenNebula econe service for emulation of the Amazon AWS interface for EC2.

Examples

Basic example:

class { "opennebula::econe":
  one_xmlrpc => "http://oneserver:2633/RPC2",
}

opennebula::oned_conf

Oned configuration class. Generally used by the opennebula::controller class only.

opennebula::sunstone

This class configures sunstone to run on port 4568:

http://$fqdn:4568/

Examples

Sunstone takes no options:

class { "opennebula::sunstone": }

Resources

onecluster

Examples

Basic example:

onecluster { "bigboxes":
}

onehost

Examples

Basic example:

onehost { "node1":
  im_mad => "im_kvm",
  tm_mad => "tm_ssh",
  vm_mad => "vmm_kvm",
}

onevnet

Examples

Basic example:

onevnet { "net1":
  type => "ranged",
  bridge => "virbr4",
  public => false,
  network_size => "C",
  network_address => "192.168.55.0",
}

Context information as well:

onevnet { "net1":
  type => "ranged",
  bridge => "virbr4",
  public => false,
  network_size => "C",
  network_address => "192.168.55.0",
  context => {
    'gateway' => "192.168.55.254",
  }
}

onevm

Examples

Basic example:

onevm { "node1":
  memory => "256",
  cpu => 1,
  vcpu => 1,
  os_arch => "x86_64",
  disks => [
    { image => "debian-wheezy-amd64", 
      driver => "qcow2", 
      target => "vda" }
  ],
  graphics_type => "vnc",
  graphics_listen => "0.0.0.0",
  context => {
    hostname => '$NAME',
    gateway => '$NETWORK[GATEWAY]',
    dns => '$NETWORK[DNS]',
    ip => '$NIC[IP]',
    files => '/var/lib/one/context/init.sh',
    target => "vdb",
  }
}

oneimage

Examples

Basic example:

oneimage { "debian-wheezy-64":
  description => "Debian Wheezy 64 bit image",
  type => "os",
  path => "/srv/images/debian-wheezy-64.img",
}

Facts

one_context_path

This fact returns the path to the context file on the machine. It is designed for use on virtual machines launched by OpenNebula.

one_context_var_*

These facts are returned from the contents of your context.sh file (see fact above). It allows someone in Puppet to use variables passed to a VM using OpenNebula contexts.

oneadmin_pubkey_rsa

This fact returns the contents of the oneadmin users public key. This can be used to create SSH trusts between OpenNebula nodes and controllers by exporting a resource using this fact as the contents for creating authorized key entries.

Release notes for version 0.0.1

Initial release.

Types

onecluster

Description

Type for managing clusters in OpenNebula using the oneclusterwrapper command.

Parameters
name

Name of cluster.

Properties
ensure

The basic property that the resource should be in. Valid values are present, absent.

Providers
onecluster

onecluster provider Required binaries: onecluster.

onehost

Description

Type for managing host in OpenNebula using the onehostwrapper command.

Parameters
name

Name of host.

im_mad

Information Driver

vm_mad

Virtualization Driver

tm_mad

Transfer Driver

Properties
ensure

Valid values are present, absent.

Providers
onehost

onehost provider Required binaries: onehost.

oneimage

Description

Type for managing Images in OpenNebula using the oneimage wrapper command.

Parameters
name

Name of image.

description

Description of image

type

Type of image: os, cdrom or datablock

public

Status of image, public or not.

persistent

Persistence of the image.

dev_prefix

Prefix of device: hd, sd or vd.

bus

Bus to use for disk image: ide, scsi or virtio (for KVM)

path

Path to original image that will be copied to the image repository.

source

Source to be used in the DISK attribute. Useful for non-file based images.

size

Size in MB.

fstype

FStype for disk.

Properties
ensure

Valid values are present, absent.

Providers
oneimage

oneimage provider Required binaries: oneimage.

onevm

Description

Type for managing virtual machines in OpenNebula using the onevmwrapper command.

Parameters
name

Name of virtual machine.

memory

Memory allocation for VM in megabytes.

cpu

Percentage of CPU divided by 100 required for the Virtual Machine. Half a processor is written 0.5.

vcpu

Virtual CPUs

os_kernel

Path to the OS kernel to boot the image. Required in Xen.

os_arch

CPU architecture.

os_initrd

Path to the initrd image.

os_root

Device to be mounted as root.

os_kernel_cmd

Arguments for the booting kernel.

os_bootloader

Path to the bootloader executable.

os_boot

Boot device type: hd,fd,cdrom,network

disks

Array of disk definitions.

nics

Array of nic definitions.

graphics_type

Graphics type - vnc or sdl

graphics_listen

IP to listen on.

graphics_port

Port for the VNC server. If left empty this is automatically set.

graphics_passwd

VNC password.

graphics_keymap

keyboard configuration locale to use in the VNC display

context

Pass context hash to vm.

Properties
ensure

Valid values are present, absent.

Providers
onevm

onevm provider Required binaries: onevm.

onevnet

Description

Type for managing networks in OpenNebula using the onevnetwrapper command.

Parameters
name

Name of network.

public

Public scope of the image. If true, the Virtual Network can be used by any user. If false, the Virtual Network can only be used by his owner. If omitted, the default value is false.

type

Type of network: fixed or ranged

bridge

Name of the physical bridge on each host to use.

leases

Leases to assign in fixed networking.

network_size

Size of network (A,B or C) For ranged networking

network_address

Base network for ranged networking.

context

A hash of context information to also store in the template.

Properties
ensure

Valid values are present, absent.

Providers
onevnet

onevnet provider Required binaries: onevnet.

Popular Tags

a2dismod a2enmod accelerator access acl activemq agent agnostic alerts aliases amanda amavis amazon amqp analysis and android antivirus apache apache2 apple application applications apt apticron archive asadmin Atlassian augeas auth authconfig authentication authoritative automation availability aws backup backuppc bacula balance bash basic benchmark bigtable bind blog boundary boxcar bprobe bugzilla build bzr c++ ca caching Cacti campfire capistrano cassandra ccollect CentOS cern certificate certificate_authority certificates certs cfn check chrislea ci cirrus clamav cleanup cli client cloud cloud-provisioner cloudformation cloudkick cloudwatch cluster cobbler collectd common compile compiler composite_namevars concat concatenate console control controltier create_resouces cron curl CVS cyber dashboard data database datadog db debian defaults denyhosts deployment desktop developer development device dhcp digest directory distributed dms dns dnsmasq dovecot dpkg dpm duo dynamic dynect ec2 editor elasticsearch email ENC enterprise environment ESN example42 exim experimental ext f5 face facter factor facts fail fail2ban farm fcgi fcron fedora FHS file files fileserver filesystem find firehol firewall flowdock FMRI foo foreman fpm freebsd fsck ftp func function ganglia gcc gconf gearman gearman-job-server gearmand gem generation generic Gentoo gfx git gitolite glassfish Glider gLite glusterfs gnome2 graphics greylisting grid Group groups growl ha hadoop haproxy hardware hbase hdd hdfs headless heartbeat hg hids high-availability hipchat homebew host host-keys hosts HP htdigest htpasswd HTTP httpd https icinga ignore imagemagick imap info information infrastructure initr interface inventory ip6tables iphone iproute ipset iptables ipvs irc irqbalance iscsi jabber java jdk jenkins jenkins-ci Jira joyent jre jsp keepalived kerberos kickstart krb5 kvm kwalify LANANA languages lcg lcgutil ldap library libvirt libzypp limits limits-conf linux lmsensors load load-balancing loadbalancer locale locales lock logging logical_volume logrotate logs logwatch LSB lucid LVM mac mail mailalias maintenance make manager manages_members mariadb master-election mcollective mediawiki memcached message message_bus messaging meta metche metrics mfa middleware mirror mnx mobileconfig module modules mon mongodb monit monitor monitoring Monitoring and Trending mosh motd mount mountpoint mounttab mrepo mta multi multipath multiple sites mumble munin mysql mysql-proxy mysql_proxy mysqlproxy naginator nagios namenode nameserver netinstall network network_config network_interface networking NFS nginx nmap noah node nodejs nosql notification nova nrpe ntp ntpd nullmailer OEL openfire opennebula openssh openssl openstack OpenSUSE openvpn openvz operating operating system operating systems operatingsystem operatingsystems operations opsview orchestration os ossec osx ovh pacemaker package package management packages packaging pagerduty PAM pam_access passenger password pe pear percona performance perl permissions pflogsumm php phpqa phpqatools phpsysinfo phptools physical_volume pick pkgin planet platform pop posix postfix postgres postgresql postmark ppa probe proc processor production-ready profile_d proftpd Programming Languages Proliant prosvc provider provisioner provisioning proxy psumac psumac2012 puppet puppetlabs puppetmaster puppi pure-ftpd pureftpd pushover pwgen PXE python qa queue rabbitmq rack raid rails rbenv redhat redis registry relay replication repo report reporting repositories repository request resolv resolv_conf resolvconf resolver resources rest restart rhel rhel5 rhel6 riemann role route53 RPM rpmbuild RRD rsnapshot RSpec rsync rsyslog rt ruby rubygems rundeck runtime samba satellite scm screen scribe scrumworks search SecretServer security sendmail server service services servlet settings sharding shell shortcut sieve sip sipfoundry sipx sipxecs SMF smokeping smtp snmp snmpd solaris solr sonar spam spamassassin sphinx sphinxsearch splunk sql sqlgrey sqlite ssh sshd ssl stages standard standards statistics stdlib stomp storage storeconfigs subversion subversion-client sudo SuSE SVC svn svnrepo symfony synchronisation sysctl syslog syslog-ng system systems tar tcp test Testing tftp thin thrift thycotic ticketing tidy time timezone tls tmpfs tmpwatch tomcat tomcat6 tool tools tracker" traut Trending tuning tunnel twilio twitter two type ubuntu udp unbound unconfigured untar user users utilities utils validation vcs version vhost vim virtual virtual-environment virtualhost virtualization vm vmtools vmware vmware-tools vmware_tools vnc VOIP volume volume_group voms vpn wars web web servers webapp webapp-config webserver webservers wget wiki win32 windows wordpress x x11 xen xinetd xmpp yast yum zendesk zeromq zones zookeeper zypp zypper