From f9f5aa6f2e5a1dd30ecd30b9a87321083d34b6fd Mon Sep 17 00:00:00 2001 From: Gardouille Date: Sat, 17 Jan 2015 19:07:22 +0100 Subject: [PATCH] * (#2) Add an array and a file to load additionnal module. --- CHANGELOG.md | 1 + manifests/hypervisor.pp | 3 ++ manifests/hypervisor/preconfig.pp | 29 ++++++++++++++----- manifests/params.pp | 10 +++++-- templates/hypervisor/proxmox_modules.conf.erb | 7 +++++ 5 files changed, 40 insertions(+), 10 deletions(-) create mode 100644 templates/hypervisor/proxmox_modules.conf.erb diff --git a/CHANGELOG.md b/CHANGELOG.md index b15cfed..75fa128 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ##### Changes * Add examples in README.md file. * Correct indentation, double quote, ... +* (#2) Add an array and a file to load additionnal module. --------------------------------------- diff --git a/manifests/hypervisor.pp b/manifests/hypervisor.pp index eeadcf1..1fe78af 100644 --- a/manifests/hypervisor.pp +++ b/manifests/hypervisor.pp @@ -53,6 +53,9 @@ class proxmox::hypervisor ( $pveproxy_service_name = $proxmox::params::pveproxy_service_name, $pveproxy_service_manage = $proxmox::params::pveproxy_service_manage, $pveproxy_service_enabled = $proxmox::params::pveproxy_service_enabled, + $pve_modules_list = $proxmox::params::pve_modules_list, + $pve_modules_file_path = $proxmox::params::pve_modules_file_path, + $pve_modules_file_content = $proxmox::params::pve_modules_file_content, ) inherits proxmox::params { include '::proxmox::hypervisor::preconfig' diff --git a/manifests/hypervisor/preconfig.pp b/manifests/hypervisor/preconfig.pp index 03dece7..f1633a7 100644 --- a/manifests/hypervisor/preconfig.pp +++ b/manifests/hypervisor/preconfig.pp @@ -12,18 +12,18 @@ class proxmox::hypervisor::preconfig { # Hostname should be resolvable via /etc/hosts #/files/etc/hosts/2 - #/files/etc/hosts/2/ipaddr = "214.938.839.123" - #/files/etc/hosts/2/canonical = "hypervisor.domain.tld" - #/files/etc/hosts/2/alias[1] = "hypervisor" - #/files/etc/hosts/1/ipaddr = "127.0.0.1" - #/files/etc/hosts/1/canonical = "localhost" + #/files/etc/hosts/2/ipaddr = '214.938.839.123' + #/files/etc/hosts/2/canonical = 'hypervisor.domain.tld' + #/files/etc/hosts/2/alias[1] = 'hypervisor' + #/files/etc/hosts/1/ipaddr = '127.0.0.1' + #/files/etc/hosts/1/canonical = 'localhost' augeas { "${::fqdn}": - context => "/files/etc/hosts", + context => '/files/etc/hosts', changes => [ #"ins ipaddr ${::ipaddress}", "set 02/ipaddr ${::ipaddress}", "set *[ipaddr = '${::ipaddress}']/canonical ${::fqdn}", - "set *[ipaddr = '${::ipaddress}']/alias[1] $hostname", + "set *[ipaddr = '${::ipaddress}']/alias[1] ${::hostname}", "set *[ipaddr = '127.0.0.1']/canonical localhost", "rm *[ipaddr = '127.0.1.1']", ], @@ -49,7 +49,7 @@ class proxmox::hypervisor::preconfig { # Set the grub default to saved to be able to use grub-set-default during # the installation - if ! defined(Augeas["grub_default"]) { + if ! defined(Augeas['grub_default']) { augeas { 'grub_default': context => '/files/etc/default/grub', changes => [ @@ -58,5 +58,18 @@ class proxmox::hypervisor::preconfig { } } + if ! defined(File['/etc/modules-load.d']) { + file { '/etc/modules-load.d': + ensure => directory, + } + } + + $values = [ 'v1', 'v2' ] + + file { "${proxmox::hypervisor::pve_modules_file_path}": + ensure => present, + content => template("${proxmox::hypervisor::pve_modules_file_content}"), + require => File['/etc/modules-load.d'], + } } # Private class: proxmox::hypervisor::preconfig diff --git a/manifests/params.pp b/manifests/params.pp index 5c01a8a..cb957a2 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -20,7 +20,7 @@ class proxmox::params { $old_pkg_ensure = 'absent' $old_pkg_name = [ 'acpid', 'linux-image-amd64', 'linux-base', 'linux-image-3.2.0-4-amd64' ] - # + # Manage PVE Enterprise repository (need a subscription) $pve_enterprise_repo_ensure = 'absent' # Pveproxy access restriction @@ -30,8 +30,14 @@ class proxmox::params { $pveproxy_deny = 'all' $pveproxy_policy = 'allow' $pveproxy_service_name = 'pveproxy' - $pveproxy_service_manage = true + $pveproxy_service_manage = true $pveproxy_service_enabled = true + + # Manage additionnals modules + $pve_modules_list = [ 'xt_iprange', 'xt_comment' ] + $pve_modules_file_path = '/etc/modules-load.d/proxmox.conf' + $pve_modules_file_content = 'proxmox/hypervisor/proxmox_modules.conf.erb' + } } default: { diff --git a/templates/hypervisor/proxmox_modules.conf.erb b/templates/hypervisor/proxmox_modules.conf.erb new file mode 100644 index 0000000..206de38 --- /dev/null +++ b/templates/hypervisor/proxmox_modules.conf.erb @@ -0,0 +1,7 @@ +#file generated by puppet +#Don't edit, please see https://forge.puppetlabs.com/gardouille/proxmox + +## Load additonnal modules for Proxmox +<% @pve_modules_list.each do |val| -%> +<%= val %> +<% end -%>