(#4) Add a new class to manage Proxmox's service (proxmox::hypervisor::service).

This commit is contained in:
gardouille 2015-01-09 19:13:05 +01:00
parent 45a5fb7651
commit 2ed08834f2
6 changed files with 45 additions and 2 deletions

View File

@ -2,6 +2,7 @@
##### Changes
* Add a variable to choose to keep PVE enterprise repo for the subscribers.
* (#4) Add an access control list for PveProxy.
* (#4) Add a new class to manage Proxmox's service (proxmox::hypervisor::service).
---------------------------------------

View File

@ -16,6 +16,7 @@ The proxmox module automates installing Proxmox on Debian systems.
* A new `sources.list` file for Proxmox
* System repository
* The static table lookup for hostnames `hosts`
* WebGUI's service (pveproxy)
### Beginning with proxmox
@ -68,6 +69,9 @@ class { 'proxmox::hypervisor':
* `pveproxy_allow`: Can be ip addresses, range or network; separated by a comma (example: '192.168.0.0/24,10.10.0.1-10.10.0.5'). Defaults to '127.0.0.1'.
* `pveproxy_deny`: Unauthorized IP addresses. Can be 'all' or ip addresses, range or network; separated by a comma. Defaults to 'all'.
* `pveproxy_policy`: The policy access. Can be 'allow' or 'deny'. Defaults to 'deny'.
* `pveproxy_service_name`: WebGUI's service name (replace Apache2 since v3.0). Defaults to 'pveproxy'.
* `pveproxy_service_manage`: If set to 'true', Puppet will manage the WebGUI's service. Can be 'true' or 'false'. Defaults to 'true'.
* `pveproxy_service_enabled`: If set to 'true', Puppet will ensure the WebGUI's service is running. Can be 'true' or 'false'. Defaults to 'true'.
Limitations
-----------

View File

@ -50,14 +50,19 @@ class proxmox::hypervisor (
$pveproxy_allow = $proxmox::params::pveproxy_allow,
$pveproxy_deny = $proxmox::params::pveproxy_deny,
$pveproxy_policy = $proxmox::params::pveproxy_policy,
$pveproxy_service_name = $proxmox::params::pveproxy_service_name,
$pveproxy_service_manage = $proxmox::params::pveproxy_service_manage,
$pveproxy_service_enabled = $proxmox::params::pveproxy_service_enabled,
) inherits proxmox::params {
include '::proxmox::hypervisor::preconfig'
include '::proxmox::hypervisor::install'
include '::proxmox::hypervisor::config'
include '::proxmox::hypervisor::service'
Class['proxmox::hypervisor::preconfig'] ->
Class['proxmox::hypervisor::install'] ->
Class['proxmox::hypervisor::config']
Class['proxmox::hypervisor::config'] ->
Class['proxmox::hypervisor::service']
} # Public class: proxmox::hypervisor

View File

@ -22,6 +22,7 @@ class proxmox::hypervisor::config {
file { "${proxmox::hypervisor::pveproxy_default_path}":
ensure => present,
content => template("${proxmox::hypervisor::pveproxy_default_content}"),
notify => Service["${proxmox::hypervisor::pveproxy_service_name}"],
}
->

View File

@ -0,0 +1,29 @@
# == Class: proxmox::hypervisor::service
#
# Manage Proxmox services
#
class proxmox::hypervisor::service {
if $proxmox::hypervisor::pveproxy_service_enabled == true {
$pveproxy_service_ensure = 'running'
} else {
$pveproxy_service_ensure = 'stopped'
}
if $::is_proxmox == 'true' {
if $proxmox::hypervisor::pveproxy_service_manage == true {
service { "${proxmox::hypervisor::pveproxy_service_name}":
ensure => "${pveproxy_service_ensure}",
enable => "${proxmox::hypervisor::pveproxy_service_enabled}",
hasstatus => false,
hasrestart => true,
}
}
}
} # Private class: proxmox::hypervisor::service

View File

@ -28,7 +28,10 @@ class proxmox::params {
$pveproxy_default_content = 'proxmox/hypervisor/pveproxy_default.erb'
$pveproxy_allow = '127.0.0.1'
$pveproxy_deny = 'all'
$pveproxy_policy = 'deny'
$pveproxy_policy = 'allow'
$pveproxy_service_name = 'pveproxy'
$pveproxy_service_manage = true
$pveproxy_service_enabled = true
}
}
default: {