* Remove OpenVZ CT management.

This commit is contained in:
gardouille 2015-12-11 09:23:46 +01:00
parent 88158e8814
commit ebcf559716
9 changed files with 3 additions and 217 deletions

View File

@ -13,3 +13,4 @@
* Remove OpenVZ configuration for the Hypervisor.
* Ensure to run a 'full-upgrade' once repository added.
* Add Postfix to the recommended packages.
* Remove OpenVZ CT management.

View File

@ -9,7 +9,6 @@
* [Beginning with Proxmox](#beginning-with-proxmox)
4. [Usage](#usage)
* [Hypervisor](#hypervisor)
* [VM](#vm)
5. [Reference](#reference)
* [Classes](#classes)
* [Defined types](#defined-types)
@ -135,21 +134,6 @@ node /hyper0[12]/ inherits "pve_node" {
```
Will create a Cluster Proxmox with name "Deepthought", the master will be "hyper01". You also can manage all ssh ressources (and host) manually on each nodes.
### VM
Only OpenVZ is supported right now but the vm's class will check-it by it self:
```
include proxmox4::vm
```
#### proxmox4::vm::openvz
Automatically call by the `proxmox4::vm` class, it will manage network configuration, but only few configurations are possible:
* Only one Virtual Ethernet device (aka veth) and it will work with **DHCP**.
* If a veth is available, it will be the main network's interface (set the default gateway throught eth0).
* If a veth is available, only one Virtual Network device (aka venet) as chance to work (the first one), because all others routes will be flushed.
* If there are only venet: no changes.
## Reference
### Classes
@ -158,8 +142,6 @@ Automatically call by the `proxmox4::vm` class, it will manage network configura
* `proxmox4::hypervisor`: Install the Proxmox hypervisor on the system.
* `proxmox4::vm`: Manage virtual machines and containers.
### Defined types
* `proxmox4::hypervisor::group`: Manage groups for Proxmox WebGUI and set permissions.
@ -188,9 +170,9 @@ proxmox4::hypervisor::user { 'marvin':
* `ve_pkg_ensure`: What to set the Virtual Environnment package to. Can be 'present', 'absent' or 'version'. Defaults to 'present'.
* `ve_pkg_name`: The list of VirtualEnvironnment packages. Can be an array [ 'proxmox-ve', 'ksm-control-daemon', 'open-iscsi', 'pve-firmware' ].
* `kernel_pkg_name`: The list of packages to install the new PVE kernel. Can be an array [ 'pve-kernel-4.2.6-1-pve', '...' ].
* `rec_pkg_name`: The list of recommended and usefull packages for Proxmox. Can be an array [ 'ntp', 'ssh', 'lvm2', 'bridge-utils' ].
* `rec_pkg_name`: The list of recommended and usefull packages for Proxmox. Can be an array [ 'bridge-utils', 'lvm2', 'ntp', 'postfix', 'ssh' ].
* `old_pkg_ensure`: What to set useless packages (non recommended, previous kernel, ...). Can be 'present' or 'absent'. Defaults to 'absent'.
* `old_pkg_name`: The list of useless packages. Can be an array [ 'acpid', 'linux-image-amd64', 'linux-base', 'linux-image-3.2.0-4-amd64' ].
* `old_pkg_name`: The list of useless packages. Can be an array [ 'acpid', 'linux-image-amd64', 'linux-base', 'linux-image-3.16.0-4-amd64' ].
* `pve_enterprise_repo_ensure`: Choose to keep the PVE enterprise repository. Can be 'present' or 'absent'. Defaults to 'absent'.
* `pveproxy_default_path`: Path of the configuration file read by the PveProxy service. Defaults to '/etc/default/pveproxy'.
* `pveproxy_default_content`: Template file use to generate the previous configuration file. Default to 'proxmox/hypervisor/pveproxy_default.erb'.
@ -207,15 +189,6 @@ proxmox4::hypervisor::user { 'marvin':
* `cluster_master_ip`: The ip address of the "master" node that will create the cluster. Must be an IP address. Defaults to 'undef'.
* `cluster_name`: The cluster's name. Defaults to 'undef'.
#### proxmox4::vm
* `vm_interfaces_path`: The main network configuration's file. Defaults to '/etc/network/interfaces'.
* `vm_interfaces_content`: Template file used to generate the previous configuration file. Defaults to 'proxmox/vm/openvz_interfaces.erb'.
* `vm_interfaces_tail_path`: A second network configuration file that will be concatenated in the main. Defaults to '/etc/network/interfaces.tail'.
* `vm_interfaces_tail_content`: Template file used to generate the previous configuration file. Defaults to 'proxmox/vm/openzv_interfaces.tail.erb'.
* `network_service_name`: Network's service name. Defaults to 'networking'.
* `network_service_manage`: If set to 'true', Puppet will manage the network's service. Can be 'true' or 'false'. Defaults to 'true'.
* `network_service_enabled`: If set to 'true', Puppet will ensure the network's service is running. Can be 'true' or 'false'. Defaults to 'true'.
Other notes
-----------
By default `proxmox4::hypervisor` comes with several modules kernel load at boot time. Mainly iptables's modules to allow it in the CT.

View File

@ -1,29 +0,0 @@
# Fact: vznetmask
#
# Purpose:
# Get netmasks for Virtual Network aka venet in OpenVZ CT, for available
# network networks
#
# Resolution:
# Uses `facter/util/ip` to enumerate interfaces and return their information.
#
require 'facter/util/ip'
require 'ipaddr'
Facter::Util::IP.get_interfaces.each do |interface|
Facter.add("vznetmask_" + Facter::Util::IP.alphafy(interface)) do
setcode do
if interface =~ /^venet*/
netmask = Facter::Util::IP.get_interface_value(interface, "netmask")
if netmask == "255.255.255.255"
# It's not possible to modify the netmask from WebGUI, so it's mainly set to /32
# http://openvz.org/Venet#Adding_IP_address_to_a_container
netmask = "255.255.255.0"
end
end
netmask
end
end
end

View File

@ -1,35 +0,0 @@
# Fact: vznetwork
#
# Purpose:
# Get networks for Virtual Network aka venet in OpenVZ CT, for available
# network networks
#
# Resolution:
# Uses `facter/util/ip` to enumerate interfaces and return their information.
#
require 'facter/util/ip'
require 'ipaddr'
Facter::Util::IP.get_interfaces.each do |interface|
Facter.add("vznetwork_" + Facter::Util::IP.alphafy(interface)) do
setcode do
if interface =~ /^venet*/
ipaddress = Facter::Util::IP.get_interface_value(interface, "ipaddress")
netmask = Facter::Util::IP.get_interface_value(interface, "netmask")
if netmask == "255.255.255.255"
# It's not possible to modify the netmask from WebGUI, so it's mainly set to /32
# http://openvz.org/Venet#Adding_IP_address_to_a_container
netmask = "255.255.255.0"
end
if ipaddress && netmask
ip = IPAddr.new(ipaddress, Socket::AF_INET)
subnet = IPAddr.new(netmask, Socket::AF_INET)
ip.mask(subnet.to_s).to_s
end
end
end
end
end

View File

@ -41,16 +41,6 @@ class proxmox4::params {
}
## VM - OpenVZ
# Network
$vm_interfaces_path = '/etc/network/interfaces'
$vm_interfaces_content = 'proxmox/vm/openzv_interfaces.erb'
$vm_interfaces_tail_path = '/etc/network/interfaces.tail'
$vm_interfaces_tail_content = 'proxmox/vm/openzv_interfaces.tail.erb'
$network_service_name = 'networking'
$network_service_manage = true
$network_service_enabled = true
}
default: {
fail("Proxmox Virtual Environment only works with Debian system; And the OpenVZ configuration has been tested only with Debian family; So osfamily (${::osfamily}) or lsbdistid (${::lsbdistid}) is unsupported")

View File

@ -1,46 +0,0 @@
# == Class: proxmox4::vm
#
# Manage Virtual Machines/VM (only OpenVZ right now)
#
# === Parameters
#
#
#
# === Variables
#
#
# === Examples
#
# include proxmox4::vm
#
# === Authors
#
# Gardouille <gardouille@gmail.com>
#
# Copyright
#
# WTFPL <http://wtfpl.org/>
#
class proxmox4::vm (
$vm_interfaces_path = $proxmox4::params::vm_interfaces_path,
$vm_interfaces_content = $proxmox4::params::vm_interfaces_content,
$vm_interfaces_tail_path = $proxmox4::params::vm_interfaces_tail_path,
$vm_interfaces_tail_content = $proxmox4::params::vm_interfaces_tail_content,
$network_service_name = $proxmox4::params::network_service_name,
$network_service_manage = $proxmox4::params::network_service_manage,
$network_service_enabled = $proxmox4::params::network_service_enabled,
) inherits proxmox4::params {
case $::virtual {
'openvz': {
include proxmox4::vm::openvz
}
'kvm': {
}
default: {
fail(" => ${::virtual} <= virtual machines type is not yet supported.")
}
}
} # Public class: proxmox4::vm

View File

@ -1,41 +0,0 @@
# == Class: proxmox4::vm::openvz
#
# Manage OpenVZ virtual machines (CT aka Containers)
#
class proxmox4::vm::openvz {
File {
owner => root,
group => root,
mode => 0644,
}
# Test if a virtual interface is available
## has_interface_with needs double quoted string for the argument !
if has_interface_with("eth0") {
## has_interface_with needs double quoted string for the argument !
if has_interface_with("venet0_0") { # Virtual network available too?
# Need to configure eth0 in an interfaces.tail file because
# the main interfaces file is auto-generated by PVE (for venet config)
file { $proxmox4::vm::vm_interfaces_tail_path:
ensure => present,
content => template($proxmox4::vm::vm_interfaces_tail_content),
}
}
else { # Only virtual interface is available
# If eth0 is the only interface, push it's configuration in the standard interfaces file
file { $proxmox4::vm::vm_interfaces_path:
ensure => present,
content => template($proxmox4::vm::vm_interfaces_content),
}
} # fi
} # fi; don't need any additionnal network configuration
} # Private class: proxmox4::vm::openvz

View File

@ -1,12 +0,0 @@
# file generated by puppet
# Don't edit, please see https://forge.puppetlabs.com/gardouille/proxmox
# Auto generated lo interface
auto lo
iface lo inet loopback
# The main network interface
auto eth0
iface eth0 inet dhcp

View File

@ -1,15 +0,0 @@
# file generated by puppet
# Don't edit, please see https://forge.puppetlabs.com/gardouille/proxmox
# The main network interface
auto eth0
iface eth0 inet dhcp
# Need to delete routes creates for venet interfaces
up ip route flush table main
# Add the default gateway throught eth0
# <%= scope.lookupvar('::ipaddress_eth0') %>
up ip route add default dev eth0
up ip route add <%= scope.lookupvar('::network_eth0') %>/<%= scope.lookupvar('::netmask_eth0') %> dev eth0 protocol kernel src <%= scope.lookupvar('::ipaddress_eth0') %>
up ip route add <%= scope.lookupvar('::vznetwork_venet0_0') %>/<%= scope.lookupvar('::vznetmask_venet0_0') %> dev venet0
down ip route del default dev eth0
down ip route del <%= scope.lookupvar('::vznetwork_venet0_0') %>/<%= scope.lookupvar('::vznetmask_venet0_0') %> dev venet0