Browse Source

First try to build the module for the puppet forgelabs.

master
gardouille 5 years ago
parent
commit
d4afbfa9d0
9 changed files with 192 additions and 81 deletions
  1. +2
    -0
      .gitignore
  2. +9
    -0
      CHANGELOG.md
  3. +35
    -52
      README.md
  4. +51
    -0
      manifests/hypervisor.pp
  5. +61
    -0
      manifests/hypervisor/preconfig.pp
  6. +7
    -24
      manifests/init.pp
  7. +18
    -0
      manifests/params.pp
  8. +6
    -5
      metadata.json
  9. +3
    -0
      tests/hypervisor.pp

+ 2
- 0
.gitignore View File

@@ -0,0 +1,2 @@
pkg/
*.swp

+ 9
- 0
CHANGELOG.md 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)

+ 35
- 52
README.md 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.
* Package/service/configuration files for Proxmox
* A new `sources.list` file for Proxmox
* System repository
* The static table lookup for hostnames `hosts`

### Setup Requirements **OPTIONAL**
### Beginning with proxmox

If your module requires anything extra before setting up (pluginsync enabled,
etc.), mention it here.
To begin using proxmox module with default parameters, declare the hypervisor's class with `include proxmox::hypervisor`.

### Beginning with proxmox
## Usage

The very basic steps needed for a user to get the module up and running.
### Hypervisor

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).
```
class { 'proxmox::hypervisor':

## Usage
}
```

Put the classes, types, and resources for customizing, configuring, and doing
the fancy stuff with your module here.
**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

* `proxmox`: Main class, do nothing right now.

* `proxmox::hypervisor`: Install the Proxmox hypervisor on the system.

Limitations
-----------

## Limitations
This module will work only on Debian 7.x versions.

This is where you list OS compatibility, version compatibility, etc.
Development
-----------

## Development
Free to send contributions, fork it, ...

Since your module is awesome, other users will want to play with it. Let them
know what the ground rules for contributing are.
License
-------

## Release Notes/Contributors/Etc **Optional**
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
- 0
manifests/hypervisor.pp 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

+ 61
- 0
manifests/hypervisor/preconfig.pp 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

+ 7
- 24
manifests/init.pp 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
- 0
manifests/params.pp 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

+ 6
- 5
metadata.json View File

@@ -1,14 +1,15 @@
{
"name": "gardouille-proxmox",
"version": "0.1.0",
"author": "gardouille",
"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",
"description": "Proxmox module",
"dependencies": [
{"name":"puppetlabs-stdlib","version_requirement":">= 4.5.0"}
{"name":"puppetlabs/stdlib","version_requirement":">= 4.5.0"},
{"name":"puppetlabs/apt","version_requirement":">= 1.7.0"}
]
}


+ 3
- 0
tests/hypervisor.pp View File

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

}

Loading…
Cancel
Save