2015-01-08 23:02:50 +01:00
|
|
|
# == Class: proxmox::hypervisor::install
|
|
|
|
#
|
2015-04-17 14:45:51 +02:00
|
|
|
# Install Proxmox and inform the user he needs to reboot the system on the PVE kernel
|
2015-01-08 23:02:50 +01:00
|
|
|
#
|
|
|
|
class proxmox::hypervisor::install {
|
|
|
|
|
|
|
|
Exec {
|
|
|
|
path => [ '/bin', '/sbin', '/usr/bin', '/usr/sbin' ],
|
|
|
|
logoutput => 'on_failure',
|
|
|
|
}
|
|
|
|
|
2015-04-17 14:30:25 +02:00
|
|
|
# If the system already run a PVE kernel
|
|
|
|
if $::is_pve_kernel == 'true' {
|
2015-01-08 23:02:50 +01:00
|
|
|
|
|
|
|
# Installation of Virtual Environnment
|
|
|
|
package { $proxmox::hypervisor::ve_pkg_name:
|
2015-02-03 16:56:39 +01:00
|
|
|
ensure => $proxmox::hypervisor::ve_pkg_ensure,
|
2015-01-08 23:02:50 +01:00
|
|
|
} ->
|
|
|
|
|
|
|
|
# Remove useless packages (such as the standard kernel, acpid, ...)
|
|
|
|
package { $proxmox::hypervisor::old_pkg_name:
|
2015-02-03 16:56:39 +01:00
|
|
|
ensure => $proxmox::hypervisor::old_pkg_ensure,
|
2015-01-09 00:30:15 +01:00
|
|
|
notify => Exec['update_grub'],
|
2015-01-08 23:02:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
# Ensure that some recommended packages are present on the system
|
2015-05-13 17:16:37 +02:00
|
|
|
ensure_packages( $proxmox::hypervisor::rec_pkg_name )
|
2015-01-08 23:02:50 +01:00
|
|
|
|
2015-02-03 16:56:39 +01:00
|
|
|
}
|
2015-04-17 14:30:25 +02:00
|
|
|
else { # If the system run on a standard Debian Kernel
|
|
|
|
|
|
|
|
# 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 {
|
2015-04-17 18:19:37 +02:00
|
|
|
notify { "Please REBOOT":
|
|
|
|
message => "Need to REBOOT the system on the new PVE kernel (${proxmox::hypervisor::kernel_kvm_pkg_name}) ...",
|
|
|
|
loglevel => warning,
|
|
|
|
}
|
2015-04-17 14:30:25 +02:00
|
|
|
->
|
|
|
|
package { $proxmox::hypervisor::kernel_kvm_pkg_name:
|
|
|
|
ensure => $proxmox::hypervisor::ve_pkg_ensure,
|
2015-04-17 14:45:51 +02:00
|
|
|
notify => Exec['update_grub'],
|
2015-04-17 14:30:25 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2015-04-17 18:19:37 +02:00
|
|
|
notify { "Please REBOOT":
|
|
|
|
message => "Need to REBOOT the system on the new PVE kernel (${proxmox::hypervisor::kernel_pkg_name}) ...",
|
|
|
|
loglevel => warning,
|
|
|
|
}
|
2015-04-17 14:30:25 +02:00
|
|
|
->
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-01-08 23:02:50 +01:00
|
|
|
# Ensure the grub is update
|
|
|
|
exec { 'update_grub':
|
2015-02-03 16:56:39 +01:00
|
|
|
command => 'update-grub',
|
2015-01-08 23:02:50 +01:00
|
|
|
refreshonly => true,
|
|
|
|
}
|
|
|
|
|
|
|
|
# Choose a different line in the grub
|
|
|
|
exec { 'grub_reboot':
|
2015-02-03 16:56:39 +01:00
|
|
|
command => 'grub-reboot 2',
|
2015-01-08 23:02:50 +01:00
|
|
|
refreshonly => true,
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} # Private class: proxmox::hypervisor::install
|