make libvirt package and service optional

add two parameters:
install_libvirt: if set to false, libvirt package is not installed
establish_libvirt_service: if set to false, the libvirt service
is not created.
In both cases, you have to met dependencies yourself in your own
manifest (eg. use module puppetlabs-libvirt).

Change-Id: I0a005f8e5a59ea95219d9f6c8d5f262bc9408bcf
This commit is contained in:
Benedikt Trefzer 2014-04-03 16:45:27 +02:00
parent a65b9d1d1b
commit 82dc6ad18b
1 changed files with 29 additions and 9 deletions

View File

@ -61,6 +61,20 @@
# how many seconds it will be removed.
# Defaults to undef
#
# [*establish_libvirt_service*]
# (optional) if set to false, this class does not define
# the libvirt service. You need to define the service
# yourself eg. in an other class to match dependencies
# (Service['libvirt']).
# Defaults to true (= establish service).
#
# [*install_libvirt*]
# (optional) if set to false the libvirt package is not
# installed. You need to install the libvirt package
# yourself (e.g. in an other class) and ensure
# dependencies (Package['libvirt']).
# Defaults to true (install package).
#
class nova::compute::libvirt (
$libvirt_virt_type = 'kvm',
@ -72,6 +86,8 @@ class nova::compute::libvirt (
$remove_unused_kernels = undef,
$remove_unused_resized_minimum_age_seconds = undef,
$remove_unused_original_minimum_age_seconds = undef,
$establish_libvirt_service = true,
$install_libvirt = true,
# DEPRECATED PARAMETER
$libvirt_type = false
) {
@ -127,17 +143,21 @@ class nova::compute::libvirt (
}
}
package { 'libvirt':
ensure => present,
name => $::nova::params::libvirt_package_name,
if $install_libvirt {
package { 'libvirt':
ensure => present,
name => $::nova::params::libvirt_package_name,
}
}
service { 'libvirt' :
ensure => running,
enable => true,
name => $::nova::params::libvirt_service_name,
provider => $::nova::params::special_service_provider,
require => Package['libvirt'],
if $establish_libvirt_service {
service { 'libvirt' :
ensure => running,
enable => true,
name => $::nova::params::libvirt_service_name,
provider => $::nova::params::special_service_provider,
require => Package['libvirt'],
}
}
nova_config {