The module now install Proxmox kernel and PVE.

Update README.md
This commit is contained in:
gardouille 2015-01-08 23:02:50 +01:00
parent 552db370cd
commit 5b2c36fb55
6 changed files with 146 additions and 10 deletions

View File

@ -1,6 +1,16 @@
---------------------------------------
### 0.0.2 - 2014/01/08
New functionality release, it's now install proxmox :)
##### Changes
* (#1) Possibility to choose between newer kernel that only supports KVM or a ~2.6.32 that supports both KVM and OpenVZ.
* (#1) Install the Virtual Environment and it's works with 2 puppet run.
---------------------------------------
### 0.0.1 - 2014/01/07
Initial release.

View File

@ -2,7 +2,7 @@
## Overview
The proxmox module (will) provide a simple way to manage Proxmox hypervisor and it's virtual machines (KVM/OpenVZ) with Puppet.
The proxmox module provide a simple way to manage Proxmox hypervisor and (soon) it's virtual machines (KVM/OpenVZ) with Puppet.
## Module Description
@ -31,6 +31,13 @@ class { 'proxmox::hypervisor':
}
```
If you will use only KVM you can have a most recent kernel with:
```
class { 'proxmox::hypervisor':
kvm_only => true,
}
```
**Note**: The module will automatically reboot the system on the PVE Kernel. You will need to start again the puppet agent.
### VM
@ -45,6 +52,20 @@ class { 'proxmox::hypervisor':
* `proxmox::hypervisor`: Install the Proxmox hypervisor on the system.
### Parameters
#### proxmox::hypervisor
* `ve_pkg_ensure`: What to set the Virtual Environnment package to. Can be 'present', 'absent' or 'version'. Defaults to 'present'.
* `ve_pkg_name`: The list of VirtualEnvironnment packages. Can be an array [ 'proxmox-ve-2.6.32', 'ksm-control-daemon', 'vzprocps', 'open-iscsi', 'bootlogd', 'pve-firmware' ].
* `kvm_only`: If set to 'true', Puppet will install a newer kernel compatible only with KVM. Accepts 'true' or 'false'. Defaults to 'false'.
* `kernel_kvm_pkg_name`: The list of packages to install the newer kernel. Can be an array [ 'pve-kernel-3.10.0-5-pve', '...' ].
* `kernel_pkg_name`: The list of packages to install a kernel compatible with both KVM and OpenVZ. Can be an array [ 'pve-kernel-2.6.32-34-pve', '...' ].
* `rec_pkg_name`: The list of recommended and usefull packages for Proxmox. Can be an array [ 'ntp', 'ssh', 'lvm2', 'bridge-utils' ].
* `old_pkg_ensure`: What to set useless packages (non recommended, previous kernel, ...). Can be 'present' or 'absent'. Defaults to 'absent'.
* `old_pkg_name`: The list of useless packages. Can be an array [ 'acpid', 'linux-image-amd64', 'linux-base', 'linux-image-3.2.0-4-amd64' ].
Limitations
-----------

View File

@ -36,15 +36,22 @@
# WTFPL <http://wtfpl.org/>
#
class proxmox::hypervisor (
$ve_package_ensure = $proxmox::params::ve_package_ensure,
$old_package_ensure = $proxmox::params::old_package_ensure,
$ve_pkg_ensure = $proxmox::params::ve_pkg_ensure,
$ve_pkg_name = $proxmox::params::ve_pkg_name,
$kvm_only = $proxmox::params::kvm_only,
$kernel_kvm_pkg_name = $proxmox::params::kernel_kvm_pkg_name,
$kernel_pkg_name = $proxmox::params::kernel_pkg_name,
$rec_pkg_name = $proxmox::params::rec_pkg_name,
$old_pkg_ensure = $proxmox::params::old_pkg_ensure,
$old_pkg_name = $proxmox::params::old_pkg_name,
) inherits proxmox::params {
include '::proxmox::hypervisor::preconfig'
# include '::proxmox::hypervisor::install'
include '::proxmox::hypervisor::install'
# include '::proxmox::hypervisor::config'
# Class['proxmox::hypervisor::preconfig'] ->
Class['proxmox::hypervisor::preconfig'] ->
Class['proxmox::hypervisor::install']
# Class['proxmox::hypervisor::install'] ->
# Class['proxmox::hypervisor::config']

View File

@ -0,0 +1,85 @@
# == Class: proxmox::hypervisor::install
#
# Install Proxmox and reboot the system on the PVE kernel
#
class proxmox::hypervisor::install {
Exec {
path => [ '/bin', '/sbin', '/usr/bin', '/usr/sbin' ],
logoutput => 'on_failure',
}
# If the system run on a standard Debian Kernel
if $::kernelrelease == '3.2.0-4-amd64' {
# To avoid unwanted reboot (kernel update for example), the PVE kernel is
# installed only if the system run on a standard Debian.
# You will need to update your PVE kernel manually.
# Installation of the PVE Kernel
if $proxmox::hypervisor::kvm_only == true {
notify { "Need to install a PVE kernel (${proxmox::hypervisor::kernel_kvm_pkg_name}) and reboot the system to run it ...": }
->
# Don't use "${...}" because the kernel_kvm_pkg_name variable is an array
package { $proxmox::hypervisor::kernel_kvm_pkg_name:
ensure => "${proxmox::hypervisor::ve_pkg_ensure}",
notify => Exec['update_grub','reboot_to_pve'],
}
}
else {
notify { "Need to install a PVE kernel (${proxmox::hypervisor::kernel_pkg_name}) and reboot the system to run it ...": }
->
# Don't use "${...}" because the kernel_pkg_name variable is an array
package { $proxmox::hypervisor::kernel_pkg_name:
ensure => "${proxmox::hypervisor::ve_pkg_ensure}",
notify => Exec['update_grub','grub_reboot'],
}
# The kernel that allow KVM + OpenVZ is older than the standard Debian's
# kernel, so grub reboot must be used
}
}
else { # If the system already run a PVE kernel
# Installation of Virtual Environnment
package { $proxmox::hypervisor::ve_pkg_name:
ensure => "${proxmox::hypervisor::ve_pkg_ensure}",
} ->
# Remove useless packages (such as the standard kernel, acpid, ...)
package { $proxmox::hypervisor::old_pkg_name:
ensure => "${proxmox::hypervisor::old_pkg_ensure}",
notify => Exec['update_grub'],
}
# Ensure that some recommended packages are present on the system
# come from Proxmox and standard Debian repository
if ! defined(Package["${proxmox::hypervisor::rec_pkg_name}"]) {
package { $proxmox::hypervisor::rec_pkg_name:
ensure => "${proxmox::hypervisor::ve_pkg_ensure}",
}
} else {
notice("Warning: cannot manage the installation of ${proxmox::hypervisor::rec_pkg_name}, as another resource (perhaps ...?) is managing it.")
}
}
# Ensure the grub is update
exec { 'update_grub':
command => "update-grub",
refreshonly => true,
}
# Choose a different line in the grub
exec { 'grub_reboot':
command => "grub-reboot 2",
refreshonly => true,
notify => Exec['reboot_to_pve'],
}
# Reboot on a PVE Kernel
exec { 'reboot_to_pve':
command => "shutdown -r 1",
refreshonly => true,
}
} # Private class: proxmox::hypervisor::install

View File

@ -4,10 +4,23 @@ class proxmox::params {
case $::osfamily {
'Debian': {
if $::operatingsystem == 'Debian' and versioncmp($::operatingsystemrelease, '7.0') >= 0 {
$ve_package_ensure = 'present'
$old_package_ensure = 'absent'
# Virtual Environment packages
$ve_pkg_ensure = 'present'
$ve_pkg_name = [ 'proxmox-ve-2.6.32', 'ksm-control-daemon', 'vzprocps', 'open-iscsi', 'bootlogd', 'pve-firmware' ]
}
# PVE Kernel
$kvm_only = false
$kernel_kvm_pkg_name = [ 'pve-kernel-3.10.0-5-pve' ]
$kernel_pkg_name = [ 'pve-kernel-2.6.32-34-pve' ]
# Recommended packages
$rec_pkg_name = [ 'ntp', 'ssh', 'lvm2', 'bridge-utils' ]
# Old useless packages
$old_pkg_ensure = 'absent'
$old_pkg_name = [ 'acpid', 'linux-image-amd64', 'linux-base', 'linux-image-3.2.0-4-amd64' ]
}
}
default: {
fail("Proxmox only works with Debian system; osfamily (${::osfamily}) or lsbdistid (${::lsbdistid}) is unsupported")

View File

@ -1,6 +1,6 @@
{
"name": "gardouille-proxmox",
"version": "0.0.1",
"version": "0.0.2",
"author": "Gardouille",
"summary": "Manage Proxmox hypervisor and KVM virtual machines or OpenVZ containers.",
"license": "wtfpl",