First try to build the module for the puppet forgelabs.

This commit is contained in:
gardouille 2015-01-07 11:51:34 +01:00
parent 4eebf7efae
commit 8219c1003d
8 changed files with 196 additions and 81 deletions

9
CHANGELOG.md Normal file
View File

@ -0,0 +1,9 @@
---------------------------------------
### 0.0.1 - 2014/01/07
Initial release.
##### Changes
* Only prepare the system for Proxmox installation (proxmox::hypervisor::preconfig)

View File

@ -1,79 +1,62 @@
# proxmox
#### Table of Contents
1. [Overview](#overview)
2. [Module Description - What the module does and why it is useful](#module-description)
3. [Setup - The basics of getting started with proxmox](#setup)
* [What proxmox affects](#what-proxmox-affects)
* [Setup requirements](#setup-requirements)
* [Beginning with proxmox](#beginning-with-proxmox)
4. [Usage - Configuration options and additional functionality](#usage)
5. [Reference - An under-the-hood peek at what the module is doing and how](#reference)
5. [Limitations - OS compatibility, etc.](#limitations)
6. [Development - Guide for contributing to the module](#development)
## Overview
A one-maybe-two sentence summary of what the module does/what problem it solves.
This is your 30 second elevator pitch for your module. Consider including
OS/Puppet version it works with.
The proxmox module (will) provide a simple way to manage Proxmox hypervisor and it's virtual machines (KVM/OpenVZ) with Puppet.
## Module Description
If applicable, this section should have a brief description of the technology
the module integrates with and what that integration enables. This section
should answer the questions: "What does this module *do*?" and "Why would I use
it?"
If your module has a range of functionality (installation, configuration,
management, etc.) this is the time to mention it.
The proxmox module automates installing Proxmox on Debian systems.
## Setup
### What proxmox affects
### What proxmox affects:
* A list of files, packages, services, or operations that the module will alter,
impact, or execute on the system it's installed on.
* This is a great place to stick any warnings.
* Can be in list or paragraph form.
### Setup Requirements **OPTIONAL**
If your module requires anything extra before setting up (pluginsync enabled,
etc.), mention it here.
* Package/service/configuration files for Proxmox
* A new `sources.list` file for Proxmox
* System repository
* The static table lookup for hostnames `hosts`
### Beginning with proxmox
The very basic steps needed for a user to get the module up and running.
If your most recent release breaks compatibility or requires particular steps
for upgrading, you may wish to include an additional section here: Upgrading
(For an example, see http://forge.puppetlabs.com/puppetlabs/firewall).
To begin using proxmox module with default parameters, declare the hypervisor's class with `include proxmox::hypervisor`.
## Usage
Put the classes, types, and resources for customizing, configuring, and doing
the fancy stuff with your module here.
### Hypervisor
```
class { 'proxmox::hypervisor':
}
```
**Note**: The module will automatically reboot the system on the PVE Kernel. You will need to start again the puppet agent.
### VM
...
## Reference
Here, list the classes, types, providers, facts, etc contained in your module.
This section should include all of the under-the-hood workings of your module so
people know what the module is touching on their system but don't need to mess
with things. (We are working on automating this section!)
### Classes
## Limitations
* `proxmox`: Main class, do nothing right now.
This is where you list OS compatibility, version compatibility, etc.
* `proxmox::hypervisor`: Install the Proxmox hypervisor on the system.
## Development
Limitations
-----------
Since your module is awesome, other users will want to play with it. Let them
know what the ground rules for contributing are.
This module will work only on Debian 7.x versions.
## Release Notes/Contributors/Etc **Optional**
Development
-----------
Free to send contributions, fork it, ...
License
-------
WTFPL (http://wtfpl.org/)
If you aren't using changelog, put your release notes here (though you should
consider using changelog). You may also add any additional sections you feel are
necessary or important to include here. Please use the `## ` header.

51
manifests/hypervisor.pp Normal file
View File

@ -0,0 +1,51 @@
# == Class: proxmox::hypervisor
#
# Manage the Proxmox hypervisor.
#
# === Parameters
#
# Document parameters here.
#
# [*sample_parameter*]
# Explanation of what this parameter affects and what it defaults to.
# e.g. "Specify one or more upstream ntp servers as an array."
#
# === Variables
#
# Here you should define a list of variables that this module would require.
#
# [*sample_variable*]
# Explanation of how this variable affects the funtion of this class and if it
# has a default. e.g. "The parameter enc_ntp_servers must be set by the
# External Node Classifier as a comma separated list of hostnames." (Note,
# global variables should not be used in preference to class parameters as of
# Puppet 2.6.)
#
# === Examples
#
# class { '::proxmox::hypervisor':
# kvm_only => true,
# }
#
# === Authors
#
# Gardouille <gardouille@gmail.com>
#
# === Copyright
#
# WTFPL <http://wtfpl.org/>
#
class proxmox::hypervisor (
$ve_package_ensure = $proxmox::params::ve_package_ensure,
$old_package_ensure = $proxmox::params::old_package_ensure,
) inherits proxmox::params {
include '::proxmox::hypervisor::preconfig'
# include '::proxmox::hypervisor::install'
# include '::proxmox::hypervisor::config'
# Class['proxmox::hypervisor::preconfig'] ->
# Class['proxmox::hypervisor::install'] ->
# Class['proxmox::hypervisor::config']
} # Public class: proxmox::hypervisor

View File

@ -0,0 +1,61 @@
# == 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
#/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",
changes => [
#"ins ipaddr ${::ipaddress}",
"set 02/ipaddr ${::ipaddress}",
"set *[ipaddr = '${::ipaddress}']/canonical ${::fqdn}",
"set *[ipaddr = '${::ipaddress}']/alias[1] $hostname",
"set *[ipaddr = '127.0.0.1']/canonical localhost",
"rm *[ipaddr = '127.0.1.1']",
],
onlyif => "match *[ipaddr = '${::ipaddress}'] size == 0",
}
->
# Remove Enterprise repository (need a subscription)
file { '/etc/apt/sources.list.d/pve-enterprise.list':
ensure => absent,
}
->
# 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',
}
# Set the grub default to saved to be able to use grub-set-default during
# the installation
if ! defined(Augeas["grub_default"]) {
augeas { "grub_default":
context => "/files/etc/default/grub",
changes => [
"set GRUB_DEFAULT saved",
],
}
}
} # Private class: proxmox::hypervisor::preconfig

View File

@ -1,41 +1,24 @@
# == Class: proxmox
#
# Full description of class proxmox here.
#
# === Parameters
#
# Document parameters here.
#
# [*sample_parameter*]
# Explanation of what this parameter affects and what it defaults to.
# e.g. "Specify one or more upstream ntp servers as an array."
#
# === Variables
#
# Here you should define a list of variables that this module would require.
#
# [*sample_variable*]
# Explanation of how this variable affects the funtion of this class and if
# it has a default. e.g. "The parameter enc_ntp_servers must be set by the
# External Node Classifier as a comma separated list of hostnames." (Note,
# global variables should be avoided in favor of class parameters as
# of Puppet 2.6.)
# This class do nothing right now.
# Please use proxmox::hypervisor to manage proxmox.
#
# === Examples
#
# class { 'proxmox':
# servers => [ 'pool.ntp.org', 'ntp.local.company.com' ],
# }
#
# === Authors
#
# Author Name <author@domain.com>
# Gardouille <gardouille@gmail.com>
#
# === Copyright
#
# Copyright 2015 Your name here, unless otherwise noted.
# WTFPL <http://wtfpl.org/>
#
class proxmox {
notify { "hello world": }
}
} # Public class: proxmox

18
manifests/params.pp Normal file
View File

@ -0,0 +1,18 @@
# == Class: proxmox::params
#
class proxmox::params {
case $::osfamily {
'Debian': {
if $::operatingsystem == 'Debian' and versioncmp($::operatingsystemrelease, '7.0') >= 0 {
$ve_package_ensure = 'present'
$old_package_ensure = 'absent'
}
}
default: {
fail("Proxmox only works with Debian system; osfamily (${::osfamily}) or lsbdistid (${::lsbdistid}) is unsupported")
}
}
} # Private class: proxmox::params

View File

@ -1,14 +1,21 @@
{
"name": "gardouille-proxmox",
"version": "0.1.0",
"version": "0.0.1",
"author": "gardouille",
"summary": "Manage Proxmox hypervisor and KVM virtual machines or OpenVZ containers.",
"license": "wtfpl",
"source": "https://git.101010.fr/puppet/proxmox",
"project_page": "https://git.101010.fr/puppet/proxmox",
"issues_url": null,
"issues_url": https://git.101010.fr/puppet/proxmox/issues,
"tags": ["proxmox", "system", "debian"],
"operatingsystem_support": [
{
"operatingsystem":"Debian",
"operatingsystemrelease":"7.0"
}
],
"dependencies": [
{"name":"puppetlabs-stdlib","version_requirement":">= 4.5.0"}
{ "name": "puppetlabs/apt", "version_requirement": ">= 1.7.0" },
{ "name": "puppetlabs/stdlib", "version_requirement": ">= 4.5.0" },
]
}

3
tests/hypervisor.pp Normal file
View File

@ -0,0 +1,3 @@
class { 'proxmox::hypervisor':
}