2015-01-07 11:51:34 +01:00
|
|
|
# == Class: proxmox::hypervisor::preconfig
|
|
|
|
#
|
|
|
|
# Before installing Proxmox some modifications have to be applied on the system
|
|
|
|
#
|
|
|
|
class proxmox::hypervisor::preconfig {
|
|
|
|
|
|
|
|
File {
|
|
|
|
owner => root,
|
|
|
|
group => root,
|
|
|
|
mode => 644,
|
|
|
|
}
|
|
|
|
|
|
|
|
# Hostname should be resolvable via /etc/hosts
|
|
|
|
#/files/etc/hosts/2
|
2015-01-17 19:07:22 +01:00
|
|
|
#/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'
|
2015-02-03 16:56:39 +01:00
|
|
|
augeas { $::fqdn:
|
2015-01-17 19:07:22 +01:00
|
|
|
context => '/files/etc/hosts',
|
2015-01-07 11:51:34 +01:00
|
|
|
changes => [
|
|
|
|
#"ins ipaddr ${::ipaddress}",
|
|
|
|
"set 02/ipaddr ${::ipaddress}",
|
|
|
|
"set *[ipaddr = '${::ipaddress}']/canonical ${::fqdn}",
|
2015-01-17 19:07:22 +01:00
|
|
|
"set *[ipaddr = '${::ipaddress}']/alias[1] ${::hostname}",
|
2015-01-07 11:51:34 +01:00
|
|
|
"set *[ipaddr = '127.0.0.1']/canonical localhost",
|
|
|
|
"rm *[ipaddr = '127.0.1.1']",
|
|
|
|
],
|
2015-01-09 00:30:15 +01:00
|
|
|
onlyif => "match *[ipaddr = '${::ipaddress}'] size == 0",
|
2015-01-07 11:51:34 +01:00
|
|
|
}
|
|
|
|
->
|
|
|
|
# Remove Enterprise repository (need a subscription)
|
|
|
|
file { '/etc/apt/sources.list.d/pve-enterprise.list':
|
2015-02-03 16:56:39 +01:00
|
|
|
ensure => $proxmox::hypervisor::pve_enterprise_repo_ensure,
|
2015-01-09 09:50:01 +01:00
|
|
|
notify => Exec[apt_update],
|
2015-01-07 11:51:34 +01:00
|
|
|
}
|
|
|
|
->
|
|
|
|
# Add the standard repository (~community)
|
|
|
|
apt::source {'proxmox':
|
|
|
|
ensure => present,
|
|
|
|
location => 'http://download.proxmox.com/debian',
|
|
|
|
release => $::lsbdistcodename,
|
|
|
|
repos => 'pve-no-subscription',
|
|
|
|
include_src => false,
|
|
|
|
key => '9887F95A',
|
|
|
|
key_server => 'keyserver.ubuntu.com',
|
|
|
|
}
|
|
|
|
|
2015-02-03 16:56:39 +01:00
|
|
|
# Set the grub default to saved to be able to use grub-set-default during
|
2015-01-07 11:51:34 +01:00
|
|
|
# the installation
|
2015-01-17 19:07:22 +01:00
|
|
|
if ! defined(Augeas['grub_default']) {
|
2015-01-09 00:30:15 +01:00
|
|
|
augeas { 'grub_default':
|
|
|
|
context => '/files/etc/default/grub',
|
2015-01-07 11:51:34 +01:00
|
|
|
changes => [
|
2015-01-09 00:30:15 +01:00
|
|
|
'set GRUB_DEFAULT saved',
|
2015-01-07 11:51:34 +01:00
|
|
|
],
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-17 19:07:22 +01:00
|
|
|
if ! defined(File['/etc/modules-load.d']) {
|
|
|
|
file { '/etc/modules-load.d':
|
|
|
|
ensure => directory,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$values = [ 'v1', 'v2' ]
|
|
|
|
|
2015-02-03 16:56:39 +01:00
|
|
|
file { $proxmox::hypervisor::pve_modules_file_path:
|
2015-01-17 19:07:22 +01:00
|
|
|
ensure => present,
|
2015-02-03 16:56:39 +01:00
|
|
|
content => template($proxmox::hypervisor::pve_modules_file_content),
|
2015-01-17 19:07:22 +01:00
|
|
|
require => File['/etc/modules-load.d'],
|
|
|
|
}
|
2015-01-07 11:51:34 +01:00
|
|
|
|
|
|
|
} # Private class: proxmox::hypervisor::preconfig
|