Updated Vagrant Puphpet box

This commit is contained in:
Marcos García de La Fuente 2014-07-29 11:23:13 +02:00
parent 3d56c8ff6a
commit 0b31bfc067
119 changed files with 2723 additions and 373 deletions

View File

@ -23,6 +23,47 @@ Vagrant.configure("2") do |config|
end
end
if Vagrant.has_plugin?('vagrant-hostsupdater')
hosts = Array.new()
if !configValues['apache']['install'].nil? &&
configValues['apache']['install'].to_i == 1 &&
configValues['apache']['vhosts'].is_a?(Hash)
configValues['apache']['vhosts'].each do |i, vhost|
hosts.push(vhost['servername'])
if vhost['serveraliases'].is_a?(Array)
vhost['serveraliases'].each do |vhost_alias|
hosts.push(vhost_alias)
end
end
end
elsif !configValues['nginx']['install'].nil? &&
configValues['nginx']['install'].to_i == 1 &&
configValues['nginx']['vhosts'].is_a?(Hash)
configValues['nginx']['vhosts'].each do |i, vhost|
hosts.push(vhost['server_name'])
if vhost['server_aliases'].is_a?(Array)
vhost['server_aliases'].each do |x, vhost_alias|
hosts.push(vhost_alias)
end
end
end
end
if hosts.any?
contents = File.open("#{dir}/puphpet/shell/hostsupdater-notice.txt", 'r'){ |file| file.read }
puts "\n\033[34m#{contents}\033[0m\n"
if config.vm.hostname.to_s.strip.length == 0
config.vm.hostname = 'puphpet-dev-machine'
end
config.hostsupdater.aliases = hosts
end
end
data['vm']['synced_folder'].each do |i, folder|
if folder['source'] != '' && folder['target'] != ''
if folder['sync_type'] == 'nfs'
@ -53,6 +94,9 @@ Vagrant.configure("2") do |config|
if key == "memory"
next
end
if key == "cpus"
next
end
if key == "natdnshostresolver1"
value = value ? "on" : "off"
@ -62,6 +106,7 @@ Vagrant.configure("2") do |config|
end
virtualbox.customize ["modifyvm", :id, "--memory", "#{data['vm']['memory']}"]
virtualbox.customize ["modifyvm", :id, "--cpus", "#{data['vm']['cpus']}"]
if data['vm']['hostname'].to_s.strip.length != 0
virtualbox.customize ["modifyvm", :id, "--name", config.vm.hostname]
@ -77,11 +122,15 @@ Vagrant.configure("2") do |config|
if key == "memsize"
next
end
if key == "cpus"
next
end
v.vmx["#{key}"] = "#{value}"
end
v.vmx["memsize"] = "#{data['vm']['memory']}"
v.vmx["numvcpus"] = "#{data['vm']['cpus']}"
if data['vm']['hostname'].to_s.strip.length != 0
v.vmx["displayName"] = config.vm.hostname
@ -97,11 +146,15 @@ Vagrant.configure("2") do |config|
if key == "memsize"
next
end
if key == "cpus"
next
end
v.customize ["set", :id, "--#{key}", "#{value}"]
end
v.memory = "#{data['vm']['memory']}"
v.cpus = "#{data['vm']['cpus']}"
if data['vm']['hostname'].to_s.strip.length != 0
v.name = config.vm.hostname
@ -119,7 +172,8 @@ Vagrant.configure("2") do |config|
kg.path = "puphpet/shell/ssh-keygen.sh"
kg.args = "#{ssh_username}"
end
config.vm.provision :shell, :path => "puphpet/shell/update-puppet.sh"
config.vm.provision :shell, :path => "puphpet/shell/install-ruby.sh"
config.vm.provision :shell, :path => "puphpet/shell/install-puppet.sh"
config.vm.provision :puppet do |puppet|
puppet.facter = {
@ -183,3 +237,4 @@ Vagrant.configure("2") do |config|
end

View File

@ -2,9 +2,4 @@
* text=auto
# Force the following filetypes to have unix eols, so Windows does not break them
*.pp text eol=lf
*.sh text eol=lf
*.yaml text eol=lf
Puppetfile text eol=lf
.bash_aliases text eol=lf
.vimrc text eol=lf
*.* text eol=lf

View File

@ -5,6 +5,7 @@ vagrantfile-local:
box_url: puphpet/debian75-x64
hostname: null
memory: '512'
cpus: '1'
chosen_provider: virtualbox
network:
private_network: 192.168.42.101
@ -29,7 +30,7 @@ vagrantfile-local:
- '--hiera_config /vagrant/puphpet/puppet/hiera.yaml'
- '--parser future'
synced_folder:
jopH6005bn96:
w6GqzzS2a7lu:
source: ../../../
target: /var/www/dolibarr
sync_type: default
@ -63,8 +64,7 @@ mailcatcher:
smtp_port: 1025
http_ip: 0.0.0.0
http_port: '1080'
mailcatcher_path: /usr/local/bin
log_path: /var/log/mailcatcher/mailcatcher.log
mailcatcher_path: /usr/local/rvm/wrappers/default
firewall:
install: '1'
rules: null
@ -81,7 +81,7 @@ apache:
- php
- rewrite
vhosts:
b2tOrs1TMtoF:
syTi8VestVdG:
servername: dev.dolibarr.org
docroot: /var/www/dolibarr/htdocs
port: '80'
@ -98,8 +98,12 @@ apache:
mod_spdy: 0
nginx:
install: 0
settings:
default_vhost: 1
proxy_buffer_size: 128k
proxy_buffers: '4 256k'
vhosts:
0dU5luf5AnIe:
kZiLLcLAIVAF:
server_name: awesome.dev
server_aliases:
- www.awesome.dev
@ -154,7 +158,7 @@ mysql:
root_password: root
adminer: 0
databases:
V6H3W2FVB7Yq:
HHTBm64g1siG:
grant:
- ALTER
- CREATE

View File

@ -197,8 +197,8 @@ if is_array($server_values['packages']) and count($server_values['packages']) >
}
define add_dotdeb ($release){
apt::source { $name:
location => 'http://packages.dotdeb.org',
apt::source { "${name}-repo.puphpet":
location => 'http://repo.puphpet.com/dotdeb/',
release => $release,
repos => 'all',
required_packages => 'debian-keyring debian-archive-keyring',
@ -270,7 +270,7 @@ if hash_key_equals($mailcatcher_values, 'install', 1) {
create_resources('class', { 'mailcatcher' => $mailcatcher_values['settings'] })
if ! defined(Firewall["100 tcp/${mailcatcher_values['settings']['smtp_port']},${mailcatcher_values['settings']['http_port']}"]) {
if ! defined(Firewall["100 tcp/${mailcatcher_values['settings']['smtp_port']}, ${mailcatcher_values['settings']['http_port']}"]) {
firewall { "100 tcp/${mailcatcher_values['settings']['smtp_port']}, ${mailcatcher_values['settings']['http_port']}":
port => [$mailcatcher_values['settings']['smtp_port'], $mailcatcher_values['settings']['http_port']],
proto => tcp,
@ -290,25 +290,28 @@ if hash_key_equals($mailcatcher_values, 'install', 1) {
}
}
$supervisord_mailcatcher_options = sort(join_keys_to_values({
$mailcatcher_path = $mailcatcher_values['settings']['mailcatcher_path']
$mailcatcher_options = sort(join_keys_to_values({
' --smtp-ip' => $mailcatcher_values['settings']['smtp_ip'],
' --smtp-port' => $mailcatcher_values['settings']['smtp_port'],
' --http-ip' => $mailcatcher_values['settings']['http_ip'],
' --http-port' => $mailcatcher_values['settings']['http_port']
}, ' '))
$supervisord_mailcatcher_cmd = "mailcatcher ${supervisord_mailcatcher_options} -f >> ${mailcatcher_values['settings']['log']}"
supervisord::program { 'mailcatcher':
command => $supervisord_mailcatcher_cmd,
command => "${mailcatcher_path}/mailcatcher ${mailcatcher_options} -f",
priority => '100',
user => 'mailcatcher',
autostart => true,
autorestart => 'true',
environment => {
'PATH' => "/bin:/sbin:/usr/bin:/usr/sbin:${mailcatcher_values['settings']['path']}"
'PATH' => "/bin:/sbin:/usr/bin:/usr/sbin:${mailcatcher_path}"
},
require => Package['mailcatcher']
require => [
Class['mailcatcher::config'],
File['/var/log/mailcatcher']
],
}
}
@ -318,10 +321,6 @@ if $firewall_values == undef {
$firewall_values = hiera('firewall', false)
}
resources { 'firewall':
purge => true
}
Firewall {
before => Class['my_fw::post'],
require => Class['my_fw::pre'],
@ -389,16 +388,15 @@ if hash_key_equals($apache_values, 'install', 1) {
include puphpet::params
include apache::params
$webroot_location = $puphpet::params::apache_webroot_location
$webroot_location = $puphpet::params::apache_webroot_location
$apache_provider_types = ['virtualbox', 'vmware_fusion', 'vmware_desktop', 'parallels']
exec { "exec mkdir -p ${webroot_location}":
command => "mkdir -p ${webroot_location}",
creates => $webroot_location,
}
if (downcase($::provisioner_type) in ['virtualbox', 'vmware_fusion'])
and ! defined(File[$webroot_location])
{
if (downcase($::provisioner_type) in $apache_provider_types) and ! defined(File[$webroot_location]) {
file { $webroot_location:
ensure => directory,
mode => 0775,
@ -407,11 +405,7 @@ if hash_key_equals($apache_values, 'install', 1) {
Group['www-data']
]
}
}
if !(downcase($::provisioner_type) in ['virtualbox', 'vmware_fusion'])
and ! defined(File[$webroot_location])
{
} elsif ! (downcase($::provisioner_type) in $apache_provider_types) and ! defined(File[$webroot_location]) {
file { $webroot_location:
ensure => directory,
group => 'www-data',
@ -441,8 +435,8 @@ if hash_key_equals($apache_values, 'install', 1) {
}
if $::operatingsystem == 'ubuntu'
and hash_key_equals($php_values, 'install', 1)
and hash_key_equals($php_values, 'version', 55)
and hash_key_equals($php_values, 'install', 1)
and hash_key_equals($php_values, 'version', 55)
{
$apache_version = '2.4'
} else {
@ -496,7 +490,7 @@ if hash_key_equals($apache_values, 'install', 1) {
creates => $vhost['docroot'],
}
if (downcase($::provisioner_type) in ['virtualbox', 'vmware_fusion'])
if (downcase($::provisioner_type) in $apache_provider_types)
and ! defined(File[$vhost['docroot']])
{
file { $vhost['docroot']:
@ -504,9 +498,7 @@ if hash_key_equals($apache_values, 'install', 1) {
mode => 0765,
require => Exec["exec mkdir -p ${vhost['docroot']} @ key ${key}"]
}
}
if !(downcase($::provisioner_type) in ['virtualbox', 'vmware_fusion'])
} elsif !(downcase($::provisioner_type) in $apache_provider_types)
and ! defined(File[$vhost['docroot']])
{
file { $vhost['docroot']:
@ -523,10 +515,10 @@ if hash_key_equals($apache_values, 'install', 1) {
create_resources(apache::vhost, { "${key}" => merge($vhost, {
'custom_fragment' => template('puphpet/apache/custom_fragment.erb'),
'ssl' => 'ssl' in $vhost and str2bool($vhost['ssl']) ? { true => true, default => false },
'ssl_cert' => hash_key_true($vhost, 'ssl_cert') ? { true => $vhost['ssl_cert'], default => undef },
'ssl_key' => hash_key_true($vhost, 'ssl_cert') ? { true => $vhost['ssl_key'], default => undef },
'ssl_chain' => hash_key_true($vhost, 'ssl_cert') ? { true => $vhost['ssl_chain'], default => undef },
'ssl_certs_dir' => hash_key_true($vhost, 'ssl_cert') ? { true => $vhost['ssl_certs_dir'], default => undef }
'ssl_cert' => hash_key_true($vhost, 'ssl_cert') ? { true => $vhost['ssl_cert'], default => undef },
'ssl_key' => hash_key_true($vhost, 'ssl_key') ? { true => $vhost['ssl_key'], default => undef },
'ssl_chain' => hash_key_true($vhost, 'ssl_chain') ? { true => $vhost['ssl_chain'], default => undef },
'ssl_certs_dir' => hash_key_true($vhost, 'ssl_certs_dir') ? { true => $vhost['ssl_certs_dir'], default => undef }
})
})
@ -585,33 +577,25 @@ if hash_key_equals($nginx_values, 'install', 1) {
}
}
$webroot_location = $puphpet::params::nginx_webroot_location
$webroot_location = $puphpet::params::nginx_webroot_location
$nginx_provider_types = ['virtualbox', 'vmware_fusion', 'vmware_desktop', 'parallels']
exec { "exec mkdir -p ${webroot_location}":
command => "mkdir -p ${webroot_location}",
creates => $webroot_location,
}
if (downcase($::provisioner_type) in ['virtualbox', 'vmware_fusion'])
and ! defined(File[$webroot_location])
{
if (downcase($::provisioner_type) in $nginx_provider_types) and ! defined(File[$webroot_location]) {
file { $webroot_location:
ensure => directory,
mode => 0775,
require => [
Exec["exec mkdir -p ${webroot_location}"],
Group['www-data']
]
require => Exec["exec mkdir -p ${webroot_location}"],
}
}
if !(downcase($::provisioner_type) in ['virtualbox', 'vmware_fusion'])
and ! defined(File[$webroot_location])
{
} elsif ! (downcase($::provisioner_type) in $nginx_provider_types) and ! defined(File[$webroot_location]) {
file { $webroot_location:
ensure => directory,
group => 'www-data',
mode => 0775,
group => 'www-data',
require => [
Exec["exec mkdir -p ${webroot_location}"],
Group['www-data']
@ -633,12 +617,10 @@ if hash_key_equals($nginx_values, 'install', 1) {
if hash_key_equals($php_values, 'install', 1) {
$php5_fpm_sock = '/var/run/php5-fpm.sock'
if $php_values['version'] == undef {
$fastcgi_pass = null
} elsif $php_values['version'] == '53' {
$fastcgi_pass = '127.0.0.1:9000'
} else {
$fastcgi_pass = "unix:${php5_fpm_sock}"
$fastcgi_pass = $php_values['version'] ? {
'53' => '127.0.0.1:9000',
undef => null,
default => "unix:${php5_fpm_sock}"
}
if $::osfamily == 'redhat' and $fastcgi_pass == "unix:${php5_fpm_sock}" {
@ -648,7 +630,7 @@ if hash_key_equals($nginx_values, 'install', 1) {
require => Package['nginx'],
}
exec { "listen = 127.0.0.1:9000 => listen = ${php5_fpm_sock}":
exec { "'listen = 127.0.0.1:9000' => 'listen = ${php5_fpm_sock}'":
command => "perl -p -i -e 's#listen = 127.0.0.1:9000#listen = ${php5_fpm_sock}#gi' /etc/php-fpm.d/www.conf",
unless => "grep -c 'listen = 127.0.0.1:9000' '${php5_fpm_sock}'",
notify => [
@ -658,25 +640,51 @@ if hash_key_equals($nginx_values, 'install', 1) {
require => Exec["create ${php5_fpm_sock} file"]
}
set_php5_fpm_sock_group_and_user { 'php_rhel':
set_nginx_php5_fpm_sock_group_and_user { 'php_rhel':
require => Exec["create ${php5_fpm_sock} file"],
}
} else {
set_php5_fpm_sock_group_and_user { 'php':
set_nginx_php5_fpm_sock_group_and_user { 'php':
require => Package['nginx'],
subscribe => Service['php5-fpm'],
}
}
} elsif hash_key_equals($hhvm_values, 'install', 1) {
$fastcgi_pass = '127.0.0.1:9000'
$fastcgi_pass = '127.0.0.1:9000'
} else {
$fastcgi_pass = ''
$fastcgi_pass = null
}
class { 'nginx': }
if count($nginx_values['vhosts']) > 0 {
each( $nginx_values['vhosts'] ) |$key, $vhost| {
if hash_key_equals($nginx_values['settings'], 'default_vhost', 1) {
$nginx_vhosts = merge($nginx_values['vhosts'], {
'default' => {
'server_name' => '_',
'server_aliases' => [],
'www_root' => '/var/www/html',
'listen_port' => 80,
'index_files' => ['index', 'index.html', 'index.htm', 'index.php'],
'envvars' => [],
'ssl' => '0',
'ssl_cert' => '',
'ssl_key' => '',
},
})
if ! defined(File[$puphpet::params::nginx_default_conf_location]) {
file { $puphpet::params::nginx_default_conf_location:
ensure => absent,
require => Package['nginx'],
notify => Class['nginx::service'],
}
}
} else {
$nginx_vhosts = $nginx_values['vhosts']
}
if count($nginx_vhosts) > 0 {
each( $nginx_vhosts ) |$key, $vhost| {
exec { "exec mkdir -p ${vhost['www_root']} @ key ${key}":
command => "mkdir -p ${vhost['www_root']}",
creates => $vhost['www_root'],
@ -698,7 +706,7 @@ if hash_key_equals($nginx_values, 'install', 1) {
}
}
create_resources(nginx_vhost, $nginx_values['vhosts'])
create_resources(nginx_vhost, $nginx_vhosts)
}
if ! defined(Firewall['100 tcp/443']) {
@ -746,41 +754,12 @@ define nginx_vhost (
$fastcgi_param_parts = []
}
if $ssl == 0 or $ssl == false or $ssl == '' {
$ssl_set = false
} else {
$ssl_set = true
}
if $ssl_cert == 0 or $ssl_cert == false or $ssl_cert == '' {
$ssl_cert_set = $puphpet::params::ssl_cert_location
} else {
$ssl_cert_set = $ssl_cert
}
if $ssl_key == 0 or $ssl_key == false or $ssl_key == '' {
$ssl_key_set = $puphpet::params::ssl_key_location
} else {
$ssl_key_set = $ssl_key
}
if $ssl_port == 0 or $ssl_port == false or $ssl_port == '' {
$ssl_port_set = '443'
} else {
$ssl_port_set = $ssl_port
}
if $rewrite_to_https == 0 or $rewrite_to_https == false or $rewrite_to_https == '' {
$rewrite_to_https_set = false
} else {
$rewrite_to_https_set = true
}
if $spdy == off or $spdy == 0 or $spdy == false or $spdy == '' {
$spdy_set = off
} else {
$spdy_set = on
}
$ssl_set = value_true($ssl) ? { true => true, default => false, }
$ssl_cert_set = value_true($ssl_cert) ? { true => $ssl_cert, default => $puphpet::params::ssl_cert_location, }
$ssl_key_set = value_true($ssl_key) ? { true => $ssl_key, default => $puphpet::params::ssl_key_location, }
$ssl_port_set = value_true($ssl_port) ? { true => $ssl_port, default => '443', }
$rewrite_to_https_set = value_true($rewrite_to_https) ? { true => true, default => false, }
$spdy_set = value_true($spdy) ? { true => on, default => off, }
nginx::resource::vhost { $server_name:
server_name => $merged_server_name,
@ -801,6 +780,19 @@ define nginx_vhost (
$fastcgi_param = concat($fastcgi_param_parts, $envvars)
$fastcgi_pass_hash = fastcgi_pass ? {
null => {},
'' => {},
default => {'fastcgi_pass' => $fastcgi_pass},
}
$location_cfg_append = merge({
'fastcgi_split_path_info' => '^(.+\.php)(/.+)$',
'fastcgi_param' => $fastcgi_param,
'fastcgi_index' => 'index.php',
'include' => 'fastcgi_params'
}, $fastcgi_pass_hash)
nginx::resource::location { "${server_name}-php":
ensure => present,
vhost => $server_name,
@ -809,20 +801,17 @@ define nginx_vhost (
try_files => ['$uri', '$uri/', "/${try_files}?\$args"],
ssl => $ssl_set,
www_root => $www_root,
location_cfg_append => {
'fastcgi_split_path_info' => '^(.+\.php)(/.+)$',
'fastcgi_param' => $fastcgi_param,
'fastcgi_pass' => $fastcgi_pass,
'fastcgi_index' => 'index.php',
'include' => 'fastcgi_params'
},
location_cfg_append => $location_cfg_append,
notify => Class['nginx::service'],
}
}
define set_php5_fpm_sock_group_and_user (){
define set_nginx_php5_fpm_sock_group_and_user () {
exec { 'set php5_fpm_sock group and user':
command => "chmod 660 ${php5_fpm_sock} && chown www-data ${php5_fpm_sock} && chgrp www-data ${php5_fpm_sock} && touch /.puphpet-stuff/php5_fpm_sock",
command => "chmod 660 ${php5_fpm_sock} && \
chown www-data ${php5_fpm_sock} && \
chgrp www-data ${php5_fpm_sock} && \
touch /.puphpet-stuff/php5_fpm_sock",
creates => '/.puphpet-stuff/php5_fpm_sock',
}
}
@ -1001,7 +990,7 @@ if hash_key_equals($php_values, 'install', 1) {
{
puphpet::ini { 'sendmail_path':
entry => 'CUSTOM/sendmail_path',
value => '/usr/bin/env catchmail',
value => "${mailcatcher_values['settings']['mailcatcher_path']}/catchmail -f",
php_version => $php_values['version'],
webserver => $php_webserver_service_ini
}
@ -1727,6 +1716,11 @@ if hash_key_equals($apache_values, 'install', 1)
}
if hash_key_equals($rabbitmq_values, 'install', 1) {
if $::osfamily == 'redhat' {
Class['erlang'] -> Class['rabbitmq']
include 'erlang'
}
create_resources('class', { 'rabbitmq' => $rabbitmq_values['settings'] })
if hash_key_equals($php_values, 'install', 1) and ! defined(Php::Pecl::Module['amqp']) {

View File

@ -0,0 +1,15 @@
source 'https://rubygems.org'
group :development, :test do
gem 'rake', :require => false
gem 'rspec-puppet', :require => false
gem 'puppetlabs_spec_helper', :require => false
gem 'puppet-lint', :require => false
gem 'rspec-system-puppet', '~>2.0.0'
end
if puppetversion = ENV['PUPPET_GEM_VERSION']
gem 'puppet', puppetversion, :require => false
else
gem 'puppet', :require => false
end

View File

@ -0,0 +1,13 @@
Copyright 2012-2014 Michael Stahnke
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -0,0 +1,8 @@
name 'stahnma-epel'
version '0.1.0'
source 'http://github.com/stahnma/puppet-module-epel'
author 'stahnma'
license 'Apache License, Version 2.0'
summary 'Setup the EPEL package repo'
description 'Setup the EPEL package repo on Centos/RHEL et all'
project_page 'http://github.com/stahnma/puppet-module-epel'

View File

@ -0,0 +1,90 @@
# Configure EPEL (Extra Repository for Enterprise Linux)
# About
This module basically just mimics the epel-release rpm. The same repos are
enabled/disabled and the GPG key is imported. In the end you will end up with
the EPEL repos configured.
The following Repos will be setup and enabled by default:
* epel
Other repositories that will setup but disabled (as per the epel-release setup)
* epel-debuginfo
* epel-source
* epel-testing
* epel-testing-debuginfo
* epel-testing-source
# Proxy
If you have an http proxy required to access the internet, you can use either
a class parameter in the _epel_ class, or edit the $proxy variable in the
params.pp file. By default no proxy is assumed.
# Why?
I am a big fan of EPEL. I actually was one of the people who helped get it
going. I am also the owner of the epel-release package, so in general this
module should stay fairly up to date with the official upstream package.
I just got sick of coding Puppet modules and basically having an assumption
that EPEL was setup or installed. I can now depend on this module instead.
I realize it is fairly trivial to get EPEL setup. Every now-and-then however
the path to epel-release changes because something changes in the package (mass
rebuild, rpm build macros updates, etc). This module will bypass the changing
URL and just setup the package mirrors.
This does mean that if you are looking for RPM macros that are normally
included with EPEL release, this will not have them.
# Futher Information
* [EPEL Wiki](http://fedoraproject.org/wiki/EPEL)
* [epel-release package information](http://mirrors.servercentral.net/fedora/epel/6/i386/repoview/epel-release.html)
# Testing
* This is commonly used on Puppet Enterprise 3.x
* This was tested using Puppet 3.3.0 on Centos5/6
* This was tested using Puppet 3.1.1 on Amazon's AWS Linux
* I assume it will work on any RHEL variant (Amazon Linux is debatable as a variant)
# Lifecycle
* No functionality has been introduced that should break Puppet 2.6 or 2.7, but I am no longer testing these versions of Puppet as they are end-of-lifed from Puppet Labs.
## Unit tests
Install the necessary gems
bundle install
Run the RSpec and puppet-lint tests
bundle exec rake ci
## System tests
If you have Vagrant >=1.1.0 you can also run system tests:
RSPEC_SET=centos-64-x64 bundle exec rake spec:system
Available RSPEC_SET options are in .nodeset.yml
# License
Apache Software License 2.0
# Author/Contributors
* Chad Metcalf <metcalfc@gmail.com>
* Joseph Swick <joseph.swick@meltwater.com>
* Matthaus Owens <mlitteken@gmail.com>
* Michael Stahnke <stahnma@puppetlabs.com>
* Michael Stahnke <stahnma@websages.com>
* Pro Cabales <proletaryo@gmail.com>
* Proletaryo Cabales <proletaryo@gmail.com>
* Stefan Goethals <stefan@zipkid.eu>
* Tim Rupp <caphrim007@gmail.com>
* Trey Dockendorf <treydock@gmail.com>
* Troy Bollinger <troy@us.ibm.com>
* Vlastimil Holer <holer@ics.muni.cz>
* Ewoud Kohl van Wijngaarden <e.kohlvanwijngaarden@oxilion.nl>

View File

@ -0,0 +1,17 @@
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'
require 'rspec-system/rake_task'
task :default do
sh %{rake -T}
end
# Disable specific puppet-lint checks
PuppetLint.configuration.send("disable_80chars")
PuppetLint.configuration.send("disable_class_inherits_from_params_class")
desc "Run rspec-puppet and puppet-lint tasks"
task :ci => [
:lint,
:spec,
]

View File

@ -0,0 +1,30 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.2.6 (GNU/Linux)
mQGiBEXopTIRBACZDBMOoFOakAjaxw1LXjeSvh/kmE35fU1rXfM7T0AV31NATCLF
l5CQiNDA4oWreDThg2Bf6+LIVTsGQb1V+XXuLak4Em5yTYwMTVB//4/nMxQEbpl/
QB2XwlJ7EQ0vW+kiPDz/7pHJz1p1jADzd9sQQicMtzysS4qT2i5A23j0VwCg1PB/
lpYqo0ZhWTrevxKMa1n34FcD/REavj0hSLQFTaKNLHRotRTF8V0BajjSaTkUT4uk
/RTaZ8Kr1mTosVtosqmdIAA2XHxi8ZLiVPPSezJjfElsSqOAxEKPL0djfpp2wrTm
l/1iVnX+PZH5DRKCbjdCMLDJhYap7YUhcPsMGSeUKrwmBCBJUPc6DhjFvyhA9IMl
1T0+A/9SKTv94ToP/JYoCTHTgnG5MoVNafisfe0wojP2mWU4gRk8X4dNGKMj6lic
vM6gne3hESyjcqZSmr7yELPPGhI9MNauJ6Ob8cTR2T12Fmv9w03DD3MnBstR6vhP
QcqZKhc5SJYYY7oVfxlSOfF4xfwcHQKoD5TOKwIAQ6T8jyFpKbQkRmVkb3JhIEVQ
RUwgPGVwZWxAZmVkb3JhcHJvamVjdC5vcmc+iGQEExECACQFAkXopTICGwMFCRLM
AwAGCwkIBwMCAxUCAwMWAgECHgECF4AACgkQEZzANiF1IfabmQCgzvE60MnHSOBa
ZXXF7uU2Vzu8EOkAoKg9h+j0NuNom6WUYZyJQt4zc5seuQINBEXopTYQCADapnR/
blrJ8FhlgNPl0X9S3JE/kygPbNXIqne4XBVYisVp0uzNCRUxNZq30MpY027JCs2J
nL2fMpwvx33f0phU029vrIZKA3CmnnwVsjcWfMJOVPBmVN7m5bGU68F+PdRIcDsl
PMOWRLkTBZOGolLgIbM4719fqA8etewILrX6uPvRDwywV7/sPCFpRcfNNBUY+Zx3
5bf4fnkaCKxgXgQS3AT+hGYhlzIqQVTkGNveHTnt4SSzgAqR9sSwQwqvEfVtYNeS
w5rDguLG41HQm1Hojv59HNYjH6F/S1rClZi21bLgZbKpCFX76qPt8CTw+iQLBPPd
yoOGHfzyp7nsfhUrAAMFB/9/H9Gpk822ZpBexQW4y3LGFo9ZSnmu+ueOZPU3SqDA
DW1ovZdYzGuJTGGM9oMl6bL8eZrcUBBOFaWge5wZczIE3hx2exEOkDdvq+MUDVD1
axmN45q/7h1NYRp5GQL2ZsoV4g9U2gMdzHOFtZCER6PP9ErVlfJpgBUCdSL93V4H
Sgpkk7znmTOklbCM6l/G/A6q4sCRqfzHwVSTiruyTBiU9lfROsAl8fjIq2OzWJ2T
P9sadBe1llUYaow7txYSUxssW+89avct35gIyrBbof5M+CBXyAOUaSWmpM2eub24
0qbqiSr/Y6Om0t6vSzR8gRk7g+1H6IE0Tt1IJCvCAMimiE8EGBECAA8FAkXopTYC
GwwFCRLMAwAACgkQEZzANiF1IfZQYgCgiZHCv4xb+sTHCn/otc1Ovvi/OgMAnRXY
bbsLFWOfmzAnNIGvFRWy+YHi
=MMNL
-----END PGP PUBLIC KEY BLOCK-----

View File

@ -0,0 +1,29 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.5 (GNU/Linux)
mQINBEvSKUIBEADLGnUj24ZVKW7liFN/JA5CgtzlNnKs7sBg7fVbNWryiE3URbn1
JXvrdwHtkKyY96/ifZ1Ld3lE2gOF61bGZ2CWwJNee76Sp9Z+isP8RQXbG5jwj/4B
M9HK7phktqFVJ8VbY2jfTjcfxRvGM8YBwXF8hx0CDZURAjvf1xRSQJ7iAo58qcHn
XtxOAvQmAbR9z6Q/h/D+Y/PhoIJp1OV4VNHCbCs9M7HUVBpgC53PDcTUQuwcgeY6
pQgo9eT1eLNSZVrJ5Bctivl1UcD6P6CIGkkeT2gNhqindRPngUXGXW7Qzoefe+fV
QqJSm7Tq2q9oqVZ46J964waCRItRySpuW5dxZO34WM6wsw2BP2MlACbH4l3luqtp
Xo3Bvfnk+HAFH3HcMuwdaulxv7zYKXCfNoSfgrpEfo2Ex4Im/I3WdtwME/Gbnwdq
3VJzgAxLVFhczDHwNkjmIdPAlNJ9/ixRjip4dgZtW8VcBCrNoL+LhDrIfjvnLdRu
vBHy9P3sCF7FZycaHlMWP6RiLtHnEMGcbZ8QpQHi2dReU1wyr9QgguGU+jqSXYar
1yEcsdRGasppNIZ8+Qawbm/a4doT10TEtPArhSoHlwbvqTDYjtfV92lC/2iwgO6g
YgG9XrO4V8dV39Ffm7oLFfvTbg5mv4Q/E6AWo/gkjmtxkculbyAvjFtYAQARAQAB
tCFFUEVMICg2KSA8ZXBlbEBmZWRvcmFwcm9qZWN0Lm9yZz6JAjYEEwECACAFAkvS
KUICGw8GCwkIBwMCBBUCCAMEFgIDAQIeAQIXgAAKCRA7Sd8qBgi4lR/GD/wLGPv9
qO39eyb9NlrwfKdUEo1tHxKdrhNz+XYrO4yVDTBZRPSuvL2yaoeSIhQOKhNPfEgT
9mdsbsgcfmoHxmGVcn+lbheWsSvcgrXuz0gLt8TGGKGGROAoLXpuUsb1HNtKEOwP
Q4z1uQ2nOz5hLRyDOV0I2LwYV8BjGIjBKUMFEUxFTsL7XOZkrAg/WbTH2PW3hrfS
WtcRA7EYonI3B80d39ffws7SmyKbS5PmZjqOPuTvV2F0tMhKIhncBwoojWZPExft
HpKhzKVh8fdDO/3P1y1Fk3Cin8UbCO9MWMFNR27fVzCANlEPljsHA+3Ez4F7uboF
p0OOEov4Yyi4BEbgqZnthTG4ub9nyiupIZ3ckPHr3nVcDUGcL6lQD/nkmNVIeLYP
x1uHPOSlWfuojAYgzRH6LL7Idg4FHHBA0to7FW8dQXFIOyNiJFAOT2j8P5+tVdq8
wB0PDSH8yRpn4HdJ9RYquau4OkjluxOWf0uRaS//SUcCZh+1/KBEOmcvBHYRZA5J
l/nakCgxGb2paQOzqqpOcHKvlyLuzO5uybMXaipLExTGJXBlXrbbASfXa/yGYSAG
iVrGz9CE6676dMlm8F+s3XXE13QZrXmjloc6jwOljnfAkjTGXjiB7OULESed96MR
XtfLk0W5Ab9pd7tKDR6QHI7rgHXfCopRnZ2VVQ==
=V/6I
-----END PGP PUBLIC KEY BLOCK-----

View File

@ -0,0 +1,29 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.11 (GNU/Linux)
mQINBFKuaIQBEAC1UphXwMqCAarPUH/ZsOFslabeTVO2pDk5YnO96f+rgZB7xArB
OSeQk7B90iqSJ85/c72OAn4OXYvT63gfCeXpJs5M7emXkPsNQWWSju99lW+AqSNm
jYWhmRlLRGl0OO7gIwj776dIXvcMNFlzSPj00N2xAqjMbjlnV2n2abAE5gq6VpqP
vFXVyfrVa/ualogDVmf6h2t4Rdpifq8qTHsHFU3xpCz+T6/dGWKGQ42ZQfTaLnDM
jToAsmY0AyevkIbX6iZVtzGvanYpPcWW4X0RDPcpqfFNZk643xI4lsZ+Y2Er9Yu5
S/8x0ly+tmmIokaE0wwbdUu740YTZjCesroYWiRg5zuQ2xfKxJoV5E+Eh+tYwGDJ
n6HfWhRgnudRRwvuJ45ztYVtKulKw8QQpd2STWrcQQDJaRWmnMooX/PATTjCBExB
9dkz38Druvk7IkHMtsIqlkAOQMdsX1d3Tov6BE2XDjIG0zFxLduJGbVwc/6rIc95
T055j36Ez0HrjxdpTGOOHxRqMK5m9flFbaxxtDnS7w77WqzW7HjFrD0VeTx2vnjj
GqchHEQpfDpFOzb8LTFhgYidyRNUflQY35WLOzLNV+pV3eQ3Jg11UFwelSNLqfQf
uFRGc+zcwkNjHh5yPvm9odR1BIfqJ6sKGPGbtPNXo7ERMRypWyRz0zi0twARAQAB
tChGZWRvcmEgRVBFTCAoNykgPGVwZWxAZmVkb3JhcHJvamVjdC5vcmc+iQI4BBMB
AgAiBQJSrmiEAhsPBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRBqL66iNSxk
5cfGD/4spqpsTjtDM7qpytKLHKruZtvuWiqt5RfvT9ww9GUUFMZ4ZZGX4nUXg49q
ixDLayWR8ddG/s5kyOi3C0uX/6inzaYyRg+Bh70brqKUK14F1BrrPi29eaKfG+Gu
MFtXdBG2a7OtPmw3yuKmq9Epv6B0mP6E5KSdvSRSqJWtGcA6wRS/wDzXJENHp5re
9Ism3CYydpy0GLRA5wo4fPB5uLdUhLEUDvh2KK//fMjja3o0L+SNz8N0aDZyn5Ax
CU9RB3EHcTecFgoy5umRj99BZrebR1NO+4gBrivIfdvD4fJNfNBHXwhSH9ACGCNv
HnXVjHQF9iHWApKkRIeh8Fr2n5dtfJEF7SEX8GbX7FbsWo29kXMrVgNqHNyDnfAB
VoPubgQdtJZJkVZAkaHrMu8AytwT62Q4eNqmJI1aWbZQNI5jWYqc6RKuCK6/F99q
thFT9gJO17+yRuL6Uv2/vgzVR1RGdwVLKwlUjGPAjYflpCQwWMAASxiv9uPyYPHc
ErSrbRG0wjIfAR3vus1OSOx3xZHZpXFfmQTsDP7zVROLzV98R3JwFAxJ4/xqeON4
vCPFU6OsT3lWQ8w7il5ohY95wmujfr6lk89kEzJdOTzcn7DBbUru33CQMGKZ3Evt
RjsC7FDbL017qxS+ZVA/HGkyfiu4cpgV8VUnbql5eAZ+1Ll6Dw==
=hdPa
-----END PGP PUBLIC KEY BLOCK-----

View File

@ -0,0 +1,11 @@
# This is a simple fact to get the Major version of an OS without having to
# have the entire LSB suite installed. LSB seems to pull in about 300 megs of
# stuff I often don't require. This fact is quick to load so it shouldn't be
# much of an issue.
Facter.add(:os_maj_version) do
setcode do
v = Facter.value(:operatingsystemrelease)
v.split('.')[0].strip
end
end

View File

@ -0,0 +1,135 @@
# Class epel
#
# Actions:
# Configure the proper repositories and import GPG keys
#
# Reqiures:
# You should probably be on an Enterprise Linux variant. (Centos, RHEL,
# Scientific, Oracle, Ascendos, et al)
#
# Sample Usage:
# include epel
#
class epel (
$epel_mirrorlist = $epel::params::epel_mirrorlist,
$epel_baseurl = $epel::params::epel_baseurl,
$epel_failovermethod = $epel::params::epel_failovermethod,
$epel_proxy = $epel::params::epel_proxy,
$epel_enabled = $epel::params::epel_enabled,
$epel_gpgcheck = $epel::params::epel_gpgcheck,
$epel_testing_baseurl = $epel::params::epel_testing_baseurl,
$epel_testing_failovermethod = $epel::params::epel_testing_failovermethod,
$epel_testing_proxy = $epel::params::epel_testing_proxy,
$epel_testing_enabled = $epel::params::epel_testing_enabled,
$epel_testing_gpgcheck = $epel::params::epel_testing_gpgcheck,
$epel_source_mirrorlist = $epel::params::epel_source_mirrorlist,
$epel_source_baseurl = $epel::params::epel_source_baseurl,
$epel_source_failovermethod = $epel::params::epel_source_failovermethod,
$epel_source_proxy = $epel::params::epel_source_proxy,
$epel_source_enabled = $epel::params::epel_source_enabled,
$epel_source_gpgcheck = $epel::params::epel_source_gpgcheck,
$epel_debuginfo_mirrorlist = $epel::params::epel_debuginfo_mirrorlist,
$epel_debuginfo_baseurl = $epel::params::epel_debuginfo_baseurl,
$epel_debuginfo_failovermethod = $epel::params::epel_debuginfo_failovermethod,
$epel_debuginfo_proxy = $epel::params::epel_debuginfo_proxy,
$epel_debuginfo_enabled = $epel::params::epel_debuginfo_enabled,
$epel_debuginfo_gpgcheck = $epel::params::epel_debuginfo_gpgcheck,
$epel_testing_source_baseurl = $epel::params::epel_testing_source_baseurl,
$epel_testing_source_failovermethod = $epel::params::epel_testing_source_failovermethod,
$epel_testing_source_proxy = $epel::params::epel_testing_source_proxy,
$epel_testing_source_enabled = $epel::params::epel_testing_source_enabled,
$epel_testing_source_gpgcheck = $epel::params::epel_testing_source_gpgcheck,
$epel_testing_debuginfo_baseurl = $epel::params::epel_testing_debuginfo_baseurl,
$epel_testing_debuginfo_failovermethod = $epel::params::epel_testing_debuginfo_failovermethod,
$epel_testing_debuginfo_proxy = $epel::params::epel_testing_debuginfo_proxy,
$epel_testing_debuginfo_enabled = $epel::params::epel_testing_debuginfo_enabled,
$epel_testing_debuginfo_gpgcheck = $epel::params::epel_testing_debuginfo_gpgcheck
) inherits epel::params {
if $::osfamily == 'RedHat' and $::operatingsystem !~ /Fedora|Amazon/ {
yumrepo { 'epel-testing':
baseurl => $epel_testing_baseurl,
failovermethod => $epel_testing_failovermethod,
proxy => $epel_testing_proxy,
enabled => $epel_testing_enabled,
gpgcheck => $epel_testing_gpgcheck,
gpgkey => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-${::os_maj_version}",
descr => "Extra Packages for Enterprise Linux ${::os_maj_version} - Testing - \$basearch ",
}
yumrepo { 'epel-testing-debuginfo':
baseurl => $epel_testing_debuginfo_baseurl,
failovermethod => $epel_testing_debuginfo_failovermethod,
proxy => $epel_testing_debuginfo_proxy,
enabled => $epel_testing_debuginfo_enabled,
gpgcheck => $epel_testing_debuginfo_gpgcheck,
gpgkey => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-${::os_maj_version}",
descr => "Extra Packages for Enterprise Linux ${::os_maj_version} - Testing - \$basearch - Debug",
}
yumrepo { 'epel-testing-source':
baseurl => $epel_testing_source_baseurl,
failovermethod => $epel_testing_source_failovermethod,
proxy => $epel_testing_source_proxy,
enabled => $epel_testing_source_enabled,
gpgcheck => $epel_testing_source_gpgcheck,
gpgkey => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-${::os_maj_version}",
descr => "Extra Packages for Enterprise Linux ${::os_maj_version} - Testing - \$basearch - Source",
}
yumrepo { 'epel':
mirrorlist => $epel_mirrorlist,
baseurl => $epel_baseurl,
failovermethod => $epel_failovermethod,
proxy => $epel_proxy,
enabled => $epel_enabled,
gpgcheck => $epel_gpgcheck,
gpgkey => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-${::os_maj_version}",
descr => "Extra Packages for Enterprise Linux ${::os_maj_version} - \$basearch",
}
yumrepo { 'epel-debuginfo':
mirrorlist => $epel_debuginfo_mirrorlist,
baseurl => $epel_debuginfo_baseurl,
failovermethod => $epel_debuginfo_failovermethod,
proxy => $epel_debuginfo_proxy,
enabled => $epel_debuginfo_enabled,
gpgcheck => $epel_debuginfo_gpgcheck,
gpgkey => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-${::os_maj_version}",
descr => "Extra Packages for Enterprise Linux ${::os_maj_version} - \$basearch - Debug",
}
yumrepo { 'epel-source':
mirrorlist => $epel_source_mirrorlist,
baseurl => $epel_source_baseurl,
failovermethod => $epel_source_failovermethod,
proxy => $epel_source_proxy,
enabled => $epel_source_enabled,
gpgcheck => $epel_source_gpgcheck,
gpgkey => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-${::os_maj_version}",
descr => "Extra Packages for Enterprise Linux ${::os_maj_version} - \$basearch - Source",
}
file { "/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-${::os_maj_version}":
ensure => present,
owner => 'root',
group => 'root',
mode => '0644',
source => "puppet:///modules/epel/RPM-GPG-KEY-EPEL-${::os_maj_version}",
}
epel::rpm_gpg_key{ "EPEL-${::os_maj_version}":
path => "/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-${::os_maj_version}",
before => Yumrepo['epel','epel-source','epel-debuginfo','epel-testing','epel-testing-source','epel-testing-debuginfo'],
}
} elsif $::osfamily == 'RedHat' and $::operatingsystem == 'Amazon' {
yumrepo { 'epel':
enabled => $epel_enabled,
gpgcheck => $epel_gpgcheck,
}
} else {
notice ("Your operating system ${::operatingsystem} will not have the EPEL repository applied")
}
}

View File

@ -0,0 +1,45 @@
# Optional parameters in setting up EPEL
class epel::params {
# Setting to 'absent' will fall back to the yum.conf
# Setting proxy here will be the default for all repos.
#
# If you wish to set a proxy for an individual set of repos,
# you can declare $proxy in that class, and should scope to
# the most specific declaration of proxy.
$proxy = 'absent'
$epel_mirrorlist = "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-${::os_maj_version}&arch=\$basearch"
$epel_baseurl = 'absent'
$epel_failovermethod = 'priority'
$epel_proxy = $proxy
$epel_enabled = '1'
$epel_gpgcheck = '1'
$epel_testing_baseurl = "http://download.fedoraproject.org/pub/epel/testing/${::os_maj_version}/\$basearch"
$epel_testing_failovermethod = 'priority'
$epel_testing_proxy = $proxy
$epel_testing_enabled = '0'
$epel_testing_gpgcheck = '1'
$epel_source_mirrorlist = "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-source-${::os_maj_version}&arch=\$basearch"
$epel_source_baseurl = 'absent'
$epel_source_failovermethod = 'priority'
$epel_source_proxy = $proxy
$epel_source_enabled = '0'
$epel_source_gpgcheck = '1'
$epel_debuginfo_mirrorlist = "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-debug-${::os_maj_version}&arch=\$basearch"
$epel_debuginfo_baseurl = 'absent'
$epel_debuginfo_failovermethod = 'priority'
$epel_debuginfo_proxy = $proxy
$epel_debuginfo_enabled = '0'
$epel_debuginfo_gpgcheck = '1'
$epel_testing_source_baseurl = "http://download.fedoraproject.org/pub/epel/testing/${::os_maj_version}/SRPMS"
$epel_testing_source_failovermethod = 'priority'
$epel_testing_source_proxy = $proxy
$epel_testing_source_enabled = '0'
$epel_testing_source_gpgcheck = '1'
$epel_testing_debuginfo_baseurl = "http://download.fedoraproject.org/pub/epel/testing/${::os_maj_version}/\$basearch/debug"
$epel_testing_debuginfo_failovermethod = 'priority'
$epel_testing_debuginfo_proxy = $proxy
$epel_testing_debuginfo_enabled = '0'
$epel_testing_debuginfo_gpgcheck = '1'
}

View File

@ -0,0 +1,28 @@
# Define epel::rpm_gpg_key
#
# Actions:
# Import a RPM gpg key
#
# Parameters:
#
# [*path*]
# Path of the RPM GPG key to import
#
# Reqiures:
# You should probably be on an Enterprise Linux variant. (Centos, RHEL, Scientific, Oracle, Ascendos, et al)
#
# Sample Usage:
# epel::rpm_gpg_key{ "EPEL-6":
# path => "/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6"
# }
#
define epel::rpm_gpg_key($path) {
# Given the path to a key, see if it is imported, if not, import it
exec { "import-${name}":
path => '/bin:/usr/bin:/sbin:/usr/sbin',
command => "rpm --import ${path}",
unless => "rpm -q gpg-pubkey-$(echo $(gpg --throw-keyids < ${path}) | cut --characters=11-18 | tr '[A-Z]' '[a-z]')",
require => File[$path],
logoutput => 'on_failure',
}
}

View File

@ -0,0 +1,45 @@
{
"name": "stahnma-epel",
"version": "0.1.0",
"source": "http://github.com/stahnma/puppet-module-epel",
"author": "stahnma",
"license": "Apache License, Version 2.0",
"summary": "Setup the EPEL package repo",
"description": "Setup the EPEL package repo on Centos/RHEL et all",
"project_page": "http://github.com/stahnma/puppet-module-epel",
"dependencies": [
],
"types": [
],
"checksums": {
"Gemfile": "3189476f30a99858b367d955298fe469",
"LICENSE": "94f0b1430ad7e59227ccabf8232f81d5",
"Modulefile": "250a4370b189d3f2e68ffd359ee02bb5",
"README.md": "6b4c4d2e7f0f9c1b6197529fa1120c88",
"Rakefile": "946eced163d7f8e0da85bda4baa7fa9c",
"files/RPM-GPG-KEY-EPEL-5": "0466c259781def56dafe0a2cdc9de0c5",
"files/RPM-GPG-KEY-EPEL-6": "d865e6b948a74cb03bc3401c0b01b785",
"files/RPM-GPG-KEY-EPEL-7": "58fa8ae27c89f37b08429f04fd4a88cc",
"lib/facter/os_maj_version.rb": "806fb856251b605df379e973c716a41c",
"manifests/init.pp": "61856de8db1eb00700e0a9a93aea506f",
"manifests/params.pp": "4fb2e283b4ba6e41abd7a914bdd001b8",
"manifests/rpm_gpg_key.pp": "69086f12752a14b200e462afaa59a93c",
"spec/classes/epel_spec.rb": "7e8e5973fdccb866e91ed00a3fd0af4c",
"spec/classes/shared_base.rb": "a6a46eb7225a1814b9343f32190ba75b",
"spec/classes/shared_debuginfo.rb": "1bd23934bc1f7d14d2491c7741f10299",
"spec/classes/shared_gpgkey.rb": "38a62fe24acfc9cc8d740d242c9f1c85",
"spec/classes/shared_source.rb": "6581989ed1ca2edd589ed98ecb08bdfa",
"spec/classes/shared_testing.rb": "50e936b9cf241c9849cf551961492532",
"spec/classes/shared_testing_debuginfo.rb": "41e8a2215d347246ff241f1b3a819c91",
"spec/classes/shared_testing_source.rb": "8cd827b2cb0b08b1633d70784417f946",
"spec/defines/rpm_gpg_key_spec.rb": "489fa716eaa2aba013089a6cf552c5a6",
"spec/spec_helper.rb": "a5ad64bd67aa3fe2512fa7ba505c8e8b",
"spec/spec_helper_system.rb": "d24a7ffdf4b67dbbd3ef5687292f51cf",
"spec/system/basic_spec.rb": "bc475b95f390134b31d905590bf8b039",
"spec/system/usage_spec.rb": "04506df5627ecbe975acd1fd0407ae40",
"spec/unit/facter/os_maj_version_spec.rb": "67ab2730991d4a8430f1115aad46bcea",
"tests/init.pp": "7c69b7adf2ba141cb62cfc9e0704d59e"
}
}

View File

@ -0,0 +1,80 @@
require 'spec_helper'
require 'classes/shared_gpgkey'
require 'classes/shared_base'
require 'classes/shared_source'
require 'classes/shared_debuginfo'
require 'classes/shared_testing'
require 'classes/shared_testing_source'
require 'classes/shared_testing_debuginfo'
describe 'epel' do
it { should create_class('epel') }
it { should contain_class('epel::params') }
context "operatingsystem => #{default_facts[:operatingsystem]}" do
context 'os_maj_version => 6' do
include_context :base_6
include_context :gpgkey_6
include_context :epel_source_6
include_context :epel_debuginfo_6
include_context :epel_testing_6
include_context :epel_testing_source_6
include_context :epel_testing_debuginfo_6
let :facts do
default_facts.merge({
:operatingsystemrelease => '6.4',
:os_maj_version => '6',
})
end
context 'epel_baseurl => http://example.com/epel/6/x86_64' do
let(:params) {{ :epel_baseurl => "http://example.com/epel/6/x86_64" }}
it { should contain_yumrepo('epel').with('baseurl' => 'http://example.com/epel/6/x86_64') }
end
context 'epel_mirrorlist => absent' do
let(:params) {{ :epel_mirrorlist => 'absent' }}
it { should contain_yumrepo('epel').with('mirrorlist' => 'absent') }
end
end
context 'os_maj_version => 5' do
include_context :base_5
include_context :gpgkey_5
include_context :epel_source_5
include_context :epel_debuginfo_5
include_context :epel_testing_5
include_context :epel_testing_source_5
include_context :epel_testing_debuginfo_5
let :facts do
default_facts.merge({
:operatingsystemrelease => '5.9',
:os_maj_version => '5',
})
end
end
end
context 'operatingsystem => Amazon' do
let :facts do
default_facts.merge({
:operatingsystem => 'Amazon',
})
end
it { should_not contain_yumrepo('epel-testing') }
it { should_not contain_yumrepo('epel-testing-debuginfo') }
it { should_not contain_yumrepo('epel-testing-source') }
it { should_not contain_yumrepo('epel-debuginfo') }
it { should_not contain_yumrepo('epel-source') }
it do
should contain_yumrepo('epel').with({
'enabled' => '1',
'gpgcheck' => '1',
})
end
end
end

View File

@ -0,0 +1,36 @@
require 'spec_helper'
shared_context :base do
it do
should contain_yumrepo('epel').with({
'failovermethod' => 'priority',
'proxy' => 'absent',
'enabled' => '1',
'gpgcheck' => '1',
})
end
end
shared_context :base_6 do
include_context :base
it do
should contain_yumrepo('epel').with({
'mirrorlist' => "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-6&arch=$basearch",
'gpgkey' => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6",
'descr' => "Extra Packages for Enterprise Linux 6 - $basearch",
})
end
end
shared_context :base_5 do
include_context :base
it do
should contain_yumrepo('epel').with({
'mirrorlist' => "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch",
'gpgkey' => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-5",
'descr' => "Extra Packages for Enterprise Linux 5 - $basearch",
})
end
end

View File

@ -0,0 +1,36 @@
require 'spec_helper'
shared_context :epel_debuginfo do
it do
should contain_yumrepo('epel-debuginfo').with({
'proxy' => 'absent',
'failovermethod' => 'priority',
'enabled' => '0',
'gpgcheck' => '1',
})
end
end
shared_context :epel_debuginfo_6 do
include_context :epel_debuginfo
it do
should contain_yumrepo('epel-debuginfo').with({
'mirrorlist' => "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-debug-6&arch=$basearch",
'gpgkey' => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6",
'descr' => "Extra Packages for Enterprise Linux 6 - $basearch - Debug",
})
end
end
shared_context :epel_debuginfo_5 do
include_context :epel_debuginfo
it do
should contain_yumrepo('epel-debuginfo').with({
'mirrorlist' => "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-debug-5&arch=$basearch",
'gpgkey' => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-5",
'descr' => "Extra Packages for Enterprise Linux 5 - $basearch - Debug",
})
end
end

View File

@ -0,0 +1,37 @@
require 'spec_helper'
shared_context :gpgkey_6 do
it do
should contain_file("/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6").with({
'ensure' => 'present',
'owner' => 'root',
'group' => 'root',
'mode' => '0644',
'source' => "puppet:///modules/epel/RPM-GPG-KEY-EPEL-6",
})
end
it do
should contain_epel__rpm_gpg_key("EPEL-6").with({
'path' => "/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6"
})
end
end
shared_context :gpgkey_5 do
it do
should contain_file("/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-5").with({
'ensure' => 'present',
'owner' => 'root',
'group' => 'root',
'mode' => '0644',
'source' => "puppet:///modules/epel/RPM-GPG-KEY-EPEL-5",
})
end
it do
should contain_epel__rpm_gpg_key("EPEL-5").with({
'path' => "/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-5"
})
end
end

View File

@ -0,0 +1,36 @@
require 'spec_helper'
shared_context :epel_source do
it do
should contain_yumrepo('epel-source').with({
'proxy' => 'absent',
'failovermethod' => 'priority',
'enabled' => '0',
'gpgcheck' => '1',
})
end
end
shared_context :epel_source_6 do
include_context :epel_source
it do
should contain_yumrepo('epel-source').with({
'mirrorlist' => "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-source-6&arch=$basearch",
'gpgkey' => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6",
'descr' => "Extra Packages for Enterprise Linux 6 - $basearch - Source",
})
end
end
shared_context :epel_source_5 do
include_context :epel_source
it do
should contain_yumrepo('epel-source').with({
'mirrorlist' => "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-source-5&arch=$basearch",
'gpgkey' => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-5",
'descr' => "Extra Packages for Enterprise Linux 5 - $basearch - Source",
})
end
end

View File

@ -0,0 +1,36 @@
require 'spec_helper'
shared_context :epel_testing do
it do
should contain_yumrepo('epel-testing').with({
'failovermethod' => 'priority',
'proxy' => 'absent',
'enabled' => '0',
'gpgcheck' => '1',
})
end
end
shared_context :epel_testing_6 do
include_context :epel_testing
it do
should contain_yumrepo('epel-testing').with({
'baseurl' => "http://download.fedoraproject.org/pub/epel/testing/6/$basearch",
'gpgkey' => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6",
'descr' => "Extra Packages for Enterprise Linux 6 - Testing - $basearch ",
})
end
end
shared_context :epel_testing_5 do
include_context :epel_testing
it do
should contain_yumrepo('epel-testing').with({
'baseurl' => "http://download.fedoraproject.org/pub/epel/testing/5/$basearch",
'gpgkey' => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-5",
'descr' => "Extra Packages for Enterprise Linux 5 - Testing - $basearch ",
})
end
end

View File

@ -0,0 +1,36 @@
require 'spec_helper'
shared_context :epel_testing_debuginfo do
it do
should contain_yumrepo('epel-testing-debuginfo').with({
'failovermethod' => 'priority',
'proxy' => 'absent',
'enabled' => '0',
'gpgcheck' => '1',
})
end
end
shared_context :epel_testing_debuginfo_6 do
include_context :epel_testing_debuginfo
it do
should contain_yumrepo('epel-testing-debuginfo').with({
'baseurl' => "http://download.fedoraproject.org/pub/epel/testing/6/$basearch/debug",
'gpgkey' => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6",
'descr' => "Extra Packages for Enterprise Linux 6 - Testing - $basearch - Debug",
})
end
end
shared_context :epel_testing_debuginfo_5 do
include_context :epel_testing_debuginfo
it do
should contain_yumrepo('epel-testing-debuginfo').with({
'baseurl' => "http://download.fedoraproject.org/pub/epel/testing/5/$basearch/debug",
'gpgkey' => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-5",
'descr' => "Extra Packages for Enterprise Linux 5 - Testing - $basearch - Debug",
})
end
end

View File

@ -0,0 +1,36 @@
require 'spec_helper'
shared_context :epel_testing_source do
it do
should contain_yumrepo('epel-testing-source').with({
'failovermethod' => 'priority',
'proxy' => 'absent',
'enabled' => '0',
'gpgcheck' => '1',
})
end
end
shared_context :epel_testing_source_6 do
include_context :epel_testing_source
it do
should contain_yumrepo('epel-testing-source').with({
'baseurl' => "http://download.fedoraproject.org/pub/epel/testing/6/SRPMS",
'gpgkey' => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6",
'descr' => "Extra Packages for Enterprise Linux 6 - Testing - $basearch - Source",
})
end
end
shared_context :epel_testing_source_5 do
include_context :epel_testing_source
it do
should contain_yumrepo('epel-testing-source').with({
'baseurl' => "http://download.fedoraproject.org/pub/epel/testing/5/SRPMS",
'gpgkey' => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-5",
'descr' => "Extra Packages for Enterprise Linux 5 - Testing - $basearch - Source",
})
end
end

View File

@ -0,0 +1,57 @@
require 'spec_helper'
describe 'epel::rpm_gpg_key' do
context 'os_maj_version => 6' do
let :facts do
default_facts.merge({
:operatingsystemrelease => '6.4',
:os_maj_version => '6',
})
end
let :title do
'EPEL-6'
end
let :params do
{ :path => "/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6" }
end
it do
should contain_exec("import-#{title}").with({
'path' => '/bin:/usr/bin:/sbin:/usr/sbin',
'command' => "rpm --import #{params[:path]}",
'unless' => "rpm -q gpg-pubkey-$(echo $(gpg --throw-keyids < #{params[:path]}) | cut --characters=11-18 | tr '[A-Z]' '[a-z]')",
'require' => "File[#{params[:path]}]",
'logoutput' => 'on_failure',
})
end
end
context 'os_maj_version => 5' do
let :facts do
default_facts.merge({
:operatingsystemrelease => '5.9',
:os_maj_version => '5',
})
end
let :title do
'EPEL-5'
end
let :params do
{ :path => "/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-5" }
end
it do
should contain_exec("import-#{title}").with({
'path' => '/bin:/usr/bin:/sbin:/usr/sbin',
'command' => "rpm --import #{params[:path]}",
'unless' => "rpm -q gpg-pubkey-$(echo $(gpg --throw-keyids < #{params[:path]}) | cut --characters=11-18 | tr '[A-Z]' '[a-z]')",
'require' => "File[#{params[:path]}]",
'logoutput' => 'on_failure',
})
end
end
end

View File

@ -0,0 +1,8 @@
require 'puppetlabs_spec_helper/module_spec_helper'
def default_facts
{
:osfamily => 'RedHat',
:operatingsystem => 'CentOS',
}
end

View File

@ -0,0 +1,23 @@
require 'rspec-system/spec_helper'
require 'rspec-system-puppet/helpers'
include RSpecSystemPuppet::Helpers
RSpec.configure do |c|
# Project root for the this module's code
proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
# Enable colour in Jenkins
c.tty = true
c.include RSpecSystemPuppet::Helpers
# This is where we 'setup' the nodes before running our tests
c.before :suite do
# Install puppet
puppet_install
puppet_master_install
puppet_module_install(:source => proj_root, :module_name => 'epel')
end
end

View File

@ -0,0 +1,36 @@
require 'spec_helper_system'
describe 'epel class:' do
context puppet_agent do
its(:stderr) { should be_empty }
its(:exit_code) { should_not == 1 }
end
# Verify the os_maj_version fact is working
context shell 'facter --puppet os_maj_version' do
its(:stdout) { should_not be_empty }
its(:stderr) { should be_empty }
its(:exit_code) { should be_zero }
end
pp = "class { 'epel': }"
context puppet_apply pp do
its(:stderr) { should be_empty }
its(:exit_code) { should_not == 1 }
its(:refresh) { should be_nil }
its(:stderr) { should be_empty }
its(:exit_code) { should be_zero }
end
context 'test EPEL repo presence' do
facts = node.facts
# Only test for EPEL's presence if not Fedora
if facts['operatingsystem'] !~ /Fedora/
context shell '/usr/bin/yum-config-manager epel | grep -q "\[epel\]"' do
its(:exit_code) { should be_zero }
end
end
end
end

View File

@ -0,0 +1,60 @@
require 'spec_helper_system'
describe 'standage usage tests:' do
context 'test epel baseurl and mirrorlist' do
facts = node.facts
os_maj_version = facts['operatingsystemrelease'].split('.')[0]
pp = <<-EOS
class { 'epel':
epel_baseurl => 'http://dl.fedoraproject.org/pub/epel/#{os_maj_version}/x86_64/',
epel_mirrorlist => 'absent',
}
EOS
context puppet_apply pp do
its(:stderr) { should be_empty }
its(:exit_code) { should_not == 1 }
its(:refresh) { should be_nil }
its(:stderr) { should be_empty }
its(:exit_code) { should be_zero }
end
# Only test for EPEL's presence if not Fedora
if facts['operatingsystem'] !~ /Fedora/
# Test the yum config to ensure mirrorlist was emptied
context shell '/usr/bin/yum-config-manager epel | egrep "^mirrorlist ="' do
its(:stdout) { should =~ /mirrorlist =\s+/ }
end
# Test the yum config to ensure baseurl was defined
context shell '/usr/bin/yum-config-manager epel | egrep "^baseurl ="' do
its(:stdout) { should =~ /baseurl = http:\/\/dl.fedoraproject.org\/pub\/epel\/#{os_maj_version}\/x86_64\// }
end
end
end
context 'test epel-testing is enabled' do
facts = node.facts
pp = <<-EOS
class { 'epel':
epel_testing_enabled => '1',
}
EOS
context puppet_apply pp do
its(:stderr) { should be_empty }
its(:exit_code) { should_not == 1 }
its(:refresh) { should be_nil }
its(:stderr) { should be_empty }
its(:exit_code) { should be_zero }
end
# Only test for EPEL's presence if not Fedora
if facts['operatingsystem'] !~ /Fedora/
# Test the yum config to ensure epel-testing was enabled
context shell '/usr/bin/yum-config-manager epel-testing | grep -q "enabled = True"' do
its(:exit_code) { should be_zero }
end
end
end
end

View File

@ -0,0 +1,21 @@
require 'spec_helper'
describe 'os_maj_version fact' do
before :each do
Facter.clear
end
context "on 5.9 operatingsystemrelease" do
it "should have os_maj_version => 5" do
Facter.fact(:operatingsystemrelease).stubs(:value).returns("5.9")
Facter.fact(:os_maj_version).value.should == "5"
end
end
context "on 6.4 operatingsystemrelease" do
it "should have os_maj_version => 6" do
Facter.fact(:operatingsystemrelease).stubs(:value).returns("6.4")
Facter.fact(:os_maj_version).value.should == "6"
end
end
end

View File

@ -0,0 +1,3 @@
# And by test, I mean, run this thing for me using Puppet apply and I'll check
# it out.
include 'epel'

View File

@ -0,0 +1,7 @@
fixtures:
repositories:
apt: git://github.com/puppetlabs/puppetlabs-apt.git
stdlib: git://github.com/puppetlabs/puppetlabs-stdlib.git
epel: git://github.com/stahnma/puppet-module-epel.git
symlinks:
erlang: "#{source_dir}"

View File

@ -0,0 +1,35 @@
---
default_set: 'centos-64-x64'
sets:
'centos-59-x64':
nodes:
"main.foo.vm":
prefab: 'centos-59-x64'
'centos-64-x64':
nodes:
"main.foo.vm":
prefab: 'centos-64-x64'
'fedora-18-x64':
nodes:
"main.foo.vm":
prefab: 'fedora-18-x64'
'debian-607-x64':
nodes:
"main.foo.vm":
prefab: 'debian-607-x64'
'debian-70rc1-x64':
nodes:
"main.foo.vm":
prefab: 'debian-70rc1-x64'
'ubuntu-server-10044-x64':
nodes:
"main.foo.vm":
prefab: 'ubuntu-server-10044-x64'
'ubuntu-server-12042-x64':
nodes:
"main.foo.vm":
prefab: 'ubuntu-server-12042-x64'
'sles-11sp1-x64':
nodes:
"main.foo.vm":
prefab: 'sles-11sp1-x64'

View File

@ -0,0 +1 @@
--format documentation

View File

@ -0,0 +1,23 @@
---
language: ruby
bundler_args: --without development
before_install: rm Gemfile.lock || true
rvm:
- 1.8.7
- 1.9.3
- 2.0.0
script: bundle exec rake test
env:
- PUPPET_VERSION="~> 2.7.0"
- PUPPET_VERSION="~> 3.1.0"
- PUPPET_VERSION="~> 3.2.0"
- PUPPET_VERSION="~> 3.3.0"
- PUPPET_VERSION="~> 3.4.0"
matrix:
exclude:
- rvm: 2.0.0
env: PUPPET_VERSION="~> 2.7.0"
- rvm: 2.0.0
env: PUPPET_VERSION="~> 3.1.0"
- rvm: 1.9.3
env: PUPPET_VERSION="~> 2.7.0"

View File

@ -0,0 +1,15 @@
source "http://rubygems.org"
gem "rake"
gem "puppet", ENV['PUPPET_VERSION'] || '~> 3.2.0'
gem "puppet-lint"
gem "rspec-puppet", '~> 1.0.0'
gem "puppetlabs_spec_helper"
gem "rspec-system-puppet"
gem "vagrant-wrapper"
gem "puppet-syntax"
group :development do
gem "puppet-blacksmith"
end

View File

@ -0,0 +1,94 @@
GEM
remote: http://rubygems.org/
specs:
builder (3.2.2)
diff-lcs (1.2.5)
excon (0.31.0)
facter (1.7.5)
fog (1.20.0)
builder
excon (~> 0.31.0)
formatador (~> 0.2.0)
mime-types
multi_json (~> 1.0)
net-scp (~> 1.1)
net-ssh (>= 2.1.3)
nokogiri (>= 1.5.11)
formatador (0.2.4)
hiera (1.3.2)
json_pure
json_pure (1.8.1)
kwalify (0.7.2)
metaclass (0.0.4)
mime-types (1.25.1)
mocha (1.0.0)
metaclass (~> 0.0.1)
multi_json (1.8.4)
net-scp (1.1.2)
net-ssh (>= 2.6.5)
net-ssh (2.8.0)
nokogiri (1.5.11)
puppet (3.2.4)
facter (~> 1.6)
hiera (~> 1.0)
rgen (~> 0.6.5)
puppet-blacksmith (2.0.2)
nokogiri
puppet (>= 2.7.16)
rest-client
puppet-lint (0.3.2)
puppet-syntax (1.1.0)
puppet (>= 2.7.0)
rake
puppetlabs_spec_helper (0.4.1)
mocha (>= 0.10.5)
rake
rspec (>= 2.9.0)
rspec-puppet (>= 0.1.1)
rake (10.1.1)
rbvmomi (1.8.1)
builder
nokogiri (>= 1.4.1)
trollop
rest-client (1.6.7)
mime-types (>= 1.16)
rgen (0.6.6)
rspec (2.14.1)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
rspec-core (2.14.8)
rspec-expectations (2.14.5)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.14.6)
rspec-puppet (1.0.1)
rspec
rspec-system (2.8.0)
fog (~> 1.18)
kwalify (~> 0.7.2)
mime-types (~> 1.16)
net-scp (~> 1.1)
net-ssh (~> 2.7)
nokogiri (~> 1.5.10)
rbvmomi (~> 1.6)
rspec (~> 2.14)
systemu (~> 2.5)
rspec-system-puppet (2.2.1)
rspec-system (~> 2.0)
systemu (2.6.3)
trollop (2.0)
vagrant-wrapper (1.2.1.1)
PLATFORMS
ruby
DEPENDENCIES
puppet (~> 3.2.0)
puppet-blacksmith
puppet-lint
puppet-syntax
puppetlabs_spec_helper
rake
rspec-puppet (~> 1.0.0)
rspec-system-puppet
vagrant-wrapper

View File

@ -0,0 +1,207 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and
distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the
copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other
entities that control, are controlled by, or are under common control with
that entity. For the purposes of this definition, "control" means (i) the
power, direct or indirect, to cause the direction or management of such
entity, whether by contract or otherwise, or (ii) ownership of
fifty percent (50%) or more of the outstanding shares, or (iii) beneficial
ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising
permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation source,
and configuration files.
"Object" form shall mean any form resulting from mechanical transformation
or translation of a Source form, including but not limited to compiled
object code, generated documentation, and conversions to
other media types.
"Work" shall mean the work of authorship, whether in Source or Object
form, made available under the License, as indicated by a copyright notice
that is included in or attached to the work (an example is provided in the
Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form,
that is based on (or derived from) the Work and for which the editorial
revisions, annotations, elaborations, or other modifications represent,
as a whole, an original work of authorship. For the purposes of this
License, Derivative Works shall not include works that remain separable
from, or merely link (or bind by name) to the interfaces of, the Work and
Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original
version of the Work and any modifications or additions to that Work or
Derivative Works thereof, that is intentionally submitted to Licensor for
inclusion in the Work by the copyright owner or by an individual or
Legal Entity authorized to submit on behalf of the copyright owner.
For the purposes of this definition, "submitted" means any form of
electronic, verbal, or written communication sent to the Licensor or its
representatives, including but not limited to communication on electronic
mailing lists, source code control systems, and issue tracking systems
that are managed by, or on behalf of, the Licensor for the purpose of
discussing and improving the Work, but excluding communication that is
conspicuously marked or otherwise designated in writing by the copyright
owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on
behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License.
Subject to the terms and conditions of this License, each Contributor
hereby grants to You a perpetual, worldwide, non-exclusive, no-charge,
royalty-free, irrevocable copyright license to reproduce, prepare
Derivative Works of, publicly display, publicly perform, sublicense,
and distribute the Work and such Derivative Works in
Source or Object form.
3. Grant of Patent License.
Subject to the terms and conditions of this License, each Contributor
hereby grants to You a perpetual, worldwide, non-exclusive, no-charge,
royalty-free, irrevocable (except as stated in this section) patent
license to make, have made, use, offer to sell, sell, import, and
otherwise transfer the Work, where such license applies only to those
patent claims licensable by such Contributor that are necessarily
infringed by their Contribution(s) alone or by combination of their
Contribution(s) with the Work to which such Contribution(s) was submitted.
If You institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
Contribution incorporated within the Work constitutes direct or
contributory patent infringement, then any patent licenses granted to
You under this License for that Work shall terminate as of the date such
litigation is filed.
4. Redistribution.
You may reproduce and distribute copies of the Work or Derivative Works
thereof in any medium, with or without modifications, and in Source or
Object form, provided that You meet the following conditions:
1. You must give any other recipients of the Work or Derivative Works a
copy of this License; and
2. You must cause any modified files to carry prominent notices stating
that You changed the files; and
3. You must retain, in the Source form of any Derivative Works that You
distribute, all copyright, patent, trademark, and attribution notices from
the Source form of the Work, excluding those notices that do not pertain
to any part of the Derivative Works; and
4. If the Work includes a "NOTICE" text file as part of its distribution,
then any Derivative Works that You distribute must include a readable copy
of the attribution notices contained within such NOTICE file, excluding
those notices that do not pertain to any part of the Derivative Works,
in at least one of the following places: within a NOTICE text file
distributed as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or, within a
display generated by the Derivative Works, if and wherever such
third-party notices normally appear. The contents of the NOTICE file are
for informational purposes only and do not modify the License.
You may add Your own attribution notices within Derivative Works that You
distribute, alongside or as an addendum to the NOTICE text from the Work,
provided that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and may
provide additional or different license terms and conditions for use,
reproduction, or distribution of Your modifications, or for any such
Derivative Works as a whole, provided Your use, reproduction, and
distribution of the Work otherwise complies with the conditions
stated in this License.
5. Submission of Contributions.
Unless You explicitly state otherwise, any Contribution intentionally
submitted for inclusion in the Work by You to the Licensor shall be under
the terms and conditions of this License, without any additional
terms or conditions. Notwithstanding the above, nothing herein shall
supersede or modify the terms of any separate license agreement you may
have executed with Licensor regarding such Contributions.
6. Trademarks.
This License does not grant permission to use the trade names, trademarks,
service marks, or product names of the Licensor, except as required for
reasonable and customary use in describing the origin of the Work and
reproducing the content of the NOTICE file.
7. Disclaimer of Warranty.
Unless required by applicable law or agreed to in writing, Licensor
provides the Work (and each Contributor provides its Contributions)
on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied, including, without limitation, any warranties
or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS
FOR A PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any risks
associated with Your exercise of permissions under this License.
8. Limitation of Liability.
In no event and under no legal theory, whether in tort
(including negligence), contract, or otherwise, unless required by
applicable law (such as deliberate and grossly negligent acts) or agreed
to in writing, shall any Contributor be liable to You for damages,
including any direct, indirect, special, incidental, or consequential
damages of any character arising as a result of this License or out of
the use or inability to use the Work (including but not limited to damages
for loss of goodwill, work stoppage, computer failure or malfunction,
or any and all other commercial damages or losses), even if such
Contributor has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability.
While redistributing the Work or Derivative Works thereof, You may choose
to offer, and charge a fee for, acceptance of support, warranty,
indemnity, or other liability obligations and/or rights consistent with
this License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf of any
other Contributor, and only if You agree to indemnify, defend, and hold
each Contributor harmless for any liability incurred by, or claims
asserted against, such Contributor by reason of your accepting any such
warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work
To apply the Apache License to your work, attach the following boilerplate
notice, with the fields enclosed by brackets "[]" replaced with your own
identifying information. (Don't include the brackets!) The text should be
enclosed in the appropriate comment syntax for the file format. We also
recommend that a file or class name and description of purpose be included
on the same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2013 Gareth Rushgrove
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the License for the specific language governing
permissions and limitations under the License.

View File

@ -0,0 +1,10 @@
name 'garethr-erlang'
version '0.3.0'
source 'git://github.com/garethr/garethr-erlang.git'
author 'Gareth Rushgrove'
summary 'Module for installing erlang from official repos'
description 'Install one of the official erlang packages'
license 'Apache License, Version 2.0'
dependency 'puppetlabs/apt'
dependency 'puppetlabs/stdlib'
dependency 'stahnma/epel'

View File

@ -0,0 +1,28 @@
Puppet module for installing Erlang from alternative repositories.
On debian it will use the official repositories
mentioned on the [Erlang
docs](https://www.erlang-solutions.com/downloads/download-erlang-otp).
On Redhat 5 it'll use an additional EPEL repository hosted by
[Redhat](http://repos.fedorapeople.org/repos/peter/erlang/epel-erlang.repo).
On Redhat 6 it'll require EPEL.
On SUSE it'll use the official repos.
On Archlinux it'll use community repos.
This module is also available on the [Puppet
Forge](https://forge.puppetlabs.com/garethr/erlang)
[![Build
Status](https://secure.travis-ci.org/garethr/garethr-erlang.png)](http://travis-ci.org/garethr/garethr-erlang)
## Usage
The module includes a single class:
include 'erlang'
By default this sets up the repository and installs the erlang package.

View File

@ -0,0 +1,35 @@
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'
require 'puppet-syntax/tasks/puppet-syntax'
require 'rspec-system/rake_task'
begin
require 'puppet_blacksmith/rake_tasks'
rescue LoadError
end
PuppetLint.configuration.log_format = "%{path}:%{linenumber}:%{check}:%{KIND}:%{message}"
PuppetLint.configuration.fail_on_warnings = true
# Forsake support for Puppet 2.6.2 for the benefit of cleaner code.
# http://puppet-lint.com/checks/class_parameter_defaults/
PuppetLint.configuration.send('disable_class_parameter_defaults')
# http://puppet-lint.com/checks/class_inherits_from_params_class/
PuppetLint.configuration.send('disable_class_inherits_from_params_class')
# http://puppet-lint.com/checks/80chars/
PuppetLint.configuration.send("disable_80chars")
exclude_paths = [
"pkg/**/*",
"vendor/**/*",
"spec/**/*",
]
PuppetLint.configuration.ignore_paths = exclude_paths
PuppetSyntax.exclude_paths = exclude_paths
desc "Run syntax, lint, and spec tests."
task :test => [
:syntax,
:lint,
:spec,
]

View File

@ -0,0 +1,45 @@
# == Class: erlang
#
# Module to install an up-to-date version of Erlang from the
# official repositories
#
# === Parameters
# [*version*]
# The package version to install, passed to ensure.
# Defaults to present.
#
class erlang (
$epel_enable = $erlang::params::epel_enable,
$key_signature = $erlang::params::key_signature,
$local_repo_location = $erlang::params::local_repo_location,
$package_name = $erlang::params::package_name,
$remote_repo_location = $erlang::params::remote_repo_location,
$remote_repo_key_location = $erlang::params::remote_repo_key_location,
$repos = $erlang::params::repos,
$version = 'present',
) inherits erlang::params {
validate_string($version)
case $::osfamily {
'Debian' : {
include '::apt'
include '::erlang::repo::apt'
}
'RedHat' : {
if $epel_enable {
# Include epel as this is a requirement for erlang in RHEL6.
include '::epel'
Class['epel'] -> Package[$package_name]
}
# This is only needed on RHEL5, RHEL6 has erlang in EPEL.
if $::operatingsystemrelease =~ /^5/ {
include '::erlang::repo::yum'
}
}
default : {
}
}
package { $package_name: ensure => $version, }
}

View File

@ -0,0 +1,29 @@
# == Class: erlang::params
#
# Default paramaters setting repository details for different
# operating systems
#
class erlang::params {
$epel_enable = false
case $::osfamily {
'Debian' : {
$key_signature = 'D208507CA14F4FCA'
$package_name = 'erlang-nox'
$remote_repo_key_location = 'http://packages.erlang-solutions.com/debian/erlang_solutions.asc'
$remote_repo_location = 'http://packages.erlang-solutions.com/debian'
$repos = 'contrib'
}
'RedHat', 'SUSE', 'Archlinux' : {
$package_name = 'erlang'
if $::operatingsystemrelease =~ /^5/ {
$local_repo_location = '/etc/yum.repos.d/epel-erlang.repo'
$remote_repo_location = 'http://repos.fedorapeople.org/repos/peter/erlang/epel-erlang.repo'
}
}
default : {
fail("The ${module_name} module is not supported on an ${::osfamily} based system.")
}
}
}

View File

@ -0,0 +1,41 @@
# == Class: erlang::repo::apt
#
# Install an apt package repository containing Erlang.
# All parameters have sane default values in erlang::params.
#
# === Parameters
# [*key_signature*]
# The signature for the key used to sign packages in the repository.
#
# [*package_name*]
# Name of the Erlang package in the specified repository.
#
# [*remote_repo_key_location*]
# URL of the public key for the remote repository.
#
# [*remote_repo_location*]
# URL of the remote debian repository.
#
# [*repos*]
# Which of the standard repositories to install from the
# remote repo. For instance main, contrib, restricted.
#
class erlang::repo::apt(
$key_signature = $erlang::key_signature,
$package_name = $erlang::package_name,
$remote_repo_key_location = $erlang::remote_repo_key_location,
$remote_repo_location = $erlang::remote_repo_location,
$repos = $erlang::repos,
) {
Class['erlang::repo::apt'] -> Package<| title == $package_name |>
apt::source { 'erlang':
include_src => false,
key => $key_signature,
key_source => $remote_repo_key_location,
location => $remote_repo_location,
repos => $repos,
}
}

View File

@ -0,0 +1,30 @@
# == Class: erlang::repo::yum
#
# Install a yum package repository containing Erlang.
# All parameters have sane default values in erlang::params.
#
# === Parameters
# [*local_repo_location*]
# File system location to store the repository details
#
# [*package_name*]
# Name of the Erlang package in the specified repository
#
# [*remote_repo_location*]
# URL of the remote repository
#
class erlang::repo::yum (
$local_repo_location = $erlang::local_repo_location,
$package_name = $erlang::package_name,
$remote_repo_location = $erlang::remote_repo_location,
) inherits erlang {
Class['erlang::repo::yum'] -> Package<| title == $package_name |>
exec { 'erlang-repo-download':
command => "curl -o ${local_repo_location} ${remote_repo_location}",
path => '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin',
creates => $local_repo_location,
}
}

View File

@ -0,0 +1,138 @@
require 'spec_helper'
describe 'erlang', :type => :class do
context 'on Debian' do
let(:facts) { {
:osfamily => 'Debian',
:lsbdistid => 'debian',
:lsbdistcodename => 'squeeze'
}}
context 'with no parameters' do
it { should compile.with_all_deps }
it { should contain_package('erlang-nox').with_ensure('present') }
it { should contain_apt__source('erlang').with(
'key_source' => 'http://packages.erlang-solutions.com/debian/erlang_solutions.asc',
'key' => 'D208507CA14F4FCA'
) }
end
context 'with a custom version' do
let(:params) { {'version' => 'absent' } }
it { should contain_package('erlang-nox').with_ensure('absent') }
end
context 'with a custom package name' do
let(:params) { {'package_name' => 'not-erlang' } }
it { should contain_package('not-erlang').with_ensure('present') }
end
context 'with custom repository details' do
let(:params) { {
'key_signature' => '1234ABCD',
'repos' => 'main',
'remote_repo_location' => 'http://example.com/debian',
'remote_repo_key_location' => 'http://example.com/debian/key.asc',
} }
it { should contain_apt__source('erlang').with(
'location' => 'http://example.com/debian',
'key_source' => 'http://example.com/debian/key.asc',
'key' => '1234ABCD',
'repos' => 'main'
) }
end
end
context 'on RedHat 5' do
let(:facts) { {:osfamily => 'RedHat', :operatingsystemrelease => '5.9' } }
context "epel enabled" do
let(:params) {{ :epel_enable => true }}
it { should contain_class('epel') }
end
context "epel disabled" do
let(:params) {{ :epel_enable => false }}
it { should_not contain_class('epel') }
end
context 'with no parameters' do
it { should contain_package('erlang').with_ensure('present') }
it { should contain_exec('erlang-repo-download').with(
'command' => 'curl -o /etc/yum.repos.d/epel-erlang.repo http://repos.fedorapeople.org/repos/peter/erlang/epel-erlang.repo',
'path' => '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin'
)
}
end
context 'with a custom repository' do
let(:params) { {
'local_repo_location' => '/tmp/yum.repos.d/tmp.repo',
'remote_repo_location' => 'http://example.com/fake.repo',
} }
it { should contain_exec('erlang-repo-download').with(
'command' => 'curl -o /tmp/yum.repos.d/tmp.repo http://example.com/fake.repo'
)
}
end
context 'with a custom version' do
let(:params) { {'version' => 'absent' } }
it { should contain_package('erlang').with_ensure('absent') }
end
end
context 'on RedHat 6' do
let(:facts) { {:osfamily => 'RedHat', :operatingsystemrelease => '6.4' } }
context "epel enabled" do
let(:params) {{ :epel_enable => true }}
it { should contain_class('epel') }
end
context "epel disabled" do
let(:params) {{ :epel_enable => false }}
it { should_not contain_class('epel') }
end
context 'with no parameters' do
it { should contain_package('erlang').with_ensure('present') }
end
context 'with a custom version' do
let(:params) { {'version' => 'absent' } }
it { should contain_package('erlang').with_ensure('absent') }
end
end
context 'on SUSE' do
let(:facts) {{ :osfamily => 'SUSE', }}
context 'with no parameters' do
it { should contain_package('erlang').with_ensure('present') }
end
context 'with a custom version' do
let(:params) { {'version' => 'absent' } }
it { should contain_package('erlang').with_ensure('absent') }
end
end
context 'on Archlinux' do
let(:facts) {{ :osfamily => 'Archlinux', }}
context 'with no parameters' do
it { should contain_package('erlang').with_ensure('present') }
end
context 'with a custom version' do
let(:params) { {'version' => 'absent' } }
it { should contain_package('erlang').with_ensure('absent') }
end
end
end

View File

@ -0,0 +1 @@
require 'puppetlabs_spec_helper/module_spec_helper'

View File

@ -0,0 +1,17 @@
require 'rspec-system/spec_helper'
require 'rspec-system-puppet/helpers'
include RSpecSystemPuppet::Helpers
RSpec.configure do |c|
proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
c.tty = true
c.include RSpecSystemPuppet::Helpers
c.before :suite do
puppet_install
puppet_module_install(:source => proj_root, :module_name => 'erlang')
shell('puppet module install puppetlabs-apt')
shell('puppet module install stahnma-epel')
end
end

View File

@ -0,0 +1,25 @@
require 'spec_helper_system'
describe 'The erlang puppet module' do
it 'should run without errors' do
pp = <<-EOS
class { 'erlang':
epel_enable => true
}
EOS
puppet_apply(pp) do |r|
r.exit_code.should == 2
r.refresh
r.exit_code.should be_zero
end
end
it 'should install the erl binary into /usr/bin' do
shell 'which erl' do |r|
r.stdout.should =~ /\/usr\/bin\/erl/
r.stderr.should be_empty
r.exit_code.should be_zero
end
end
end

View File

@ -28,7 +28,7 @@ module Puppet::Parser::Functions
return false
end
if arr[key].empty?
if arr[key] == false
return false
end
@ -36,6 +36,10 @@ module Puppet::Parser::Functions
return false
end
if arr[key].empty?
return false
end
return true
end

View File

@ -0,0 +1,45 @@
#
# value_true.rb
#
module Puppet::Parser::Functions
newfunction(:value_true, :type => :rvalue, :doc => <<-'ENDHEREDOC') do |args|
Returns true if value is truthy
ENDHEREDOC
unless args.length == 1
raise Puppet::ParseError, ("value_true(): wrong number of arguments (#{args.length}; must be 1)")
end
value = args[0]
if value.nil?
return false
end
if value == false
return false
end
if value == 0
return false
end
if value == '0'
return false
end
if value == 'false'
return false
end
if value.empty?
return false
end
return true
end
end

View File

@ -44,7 +44,11 @@ class puphpet::hhvm(
'deb http://security.debian.org/ wheezy/updates main',
'deb-src http://security.debian.org/ wheezy/updates main',
'deb http://http.us.debian.org/debian wheezy-updates main',
'deb-src http://http.us.debian.org/debian wheezy-updates main'
'deb-src http://http.us.debian.org/debian wheezy-updates main',
'deb http://http.debian.net/debian wheezy main',
'deb-src http://http.debian.net/debian wheezy main',
'deb http://http.debian.net/debian wheezy-updates main',
'deb-src http://http.debian.net/debian wheezy-updates main',
]
each( $deb_srcs ) |$value| {

View File

@ -53,9 +53,14 @@ class puphpet::params {
'Redhat' => 'php-cgi'
}
$nginx_default_conf_location = $::osfamily ? {
'Debian' => '/etc/nginx/conf.d/default.conf',
'Redhat' => '/etc/nginx/conf.d/default.conf'
}
$nginx_webroot_location = $::osfamily ? {
'Debian' => '/var/www/html',
'Redhat' => '/usr/share/nginx/html'
'Redhat' => '/var/www/html'
}
$mariadb_package_client_name = $::osfamily ? {

View File

@ -3,7 +3,8 @@
*/
define puphpet::php::pear (
$service_autorestart
$service_name = '',
$service_autorestart,
){
$package = {
@ -15,7 +16,9 @@ define puphpet::php::pear (
'pear_command_packaging' => 'alpha',
'pear_frontend_gtk2' => false,
'php_beautifier' => 'beta',
'php_parser' => 'alpha',
'php_parser_docblockparser' => 'alpha',
'soap' => 'beta',
'testing_selenium' => 'beta',
'versioncontrol_git' => 'alpha',
'versioncontrol_svn' => 'alpha',
@ -38,7 +41,8 @@ define puphpet::php::pear (
::php::pear::module { $name:
use_package => false,
preferred_state => $preferred_state,
service_autorestart => $php_webserver_restart,
service => $service_name,
service_autorestart => $service_autorestart,
}
}

View File

@ -16,7 +16,10 @@ define puphpet::php::pecl (
$pecl = $::osfamily ? {
'Debian' => {
#
'mongo' => $::lsbdistcodename ? {
'precise' => 'mongo',
default => false,
},
},
'Redhat' => {
#
@ -63,24 +66,34 @@ define puphpet::php::pecl (
}
}
$auto_answer_hash = {
'mongo' => 'no\n'
}
$downcase_name = downcase($name)
if has_key($ignore, $downcase_name) {
if has_key($auto_answer_hash, $downcase_name) {
$auto_answer = $auto_answer_hash[$downcase_name]
} else {
$auto_answer = '\\n'
}
if has_key($ignore, $downcase_name) and $ignore[$downcase_name] {
$pecl_name = $pecl[$downcase_name]
$package_name = false
$preferred_state = 'stable'
}
elsif has_key($pecl, $downcase_name) {
$pecl_name = false
elsif has_key($pecl, $downcase_name) and $pecl[$downcase_name] {
$pecl_name = $pecl[$downcase_name]
$package_name = false
$preferred_state = false
$preferred_state = 'stable'
}
elsif has_key($pecl_beta, $downcase_name) and $pecl_beta[$downcase_name] {
$pecl_name = $pecl_beta[$downcase_name]
$package_name = false
$preferred_state = 'beta'
}
elsif has_key($package, $downcase_name) {
elsif has_key($package, $downcase_name) and $package[$downcase_name] {
$pecl_name = false
$package_name = $package[$downcase_name]
}
@ -93,6 +106,7 @@ define puphpet::php::pecl (
::php::pecl::module { $pecl_name:
use_package => false,
preferred_state => $preferred_state,
auto_answer => $auto_answer,
service_autorestart => $service_autorestart,
}
}

View File

@ -0,0 +1,18 @@
# This depends on
# ajcrowe/supervisord: https://github.com/ajcrowe/puppet-supervisord
class puphpet::supervisord {
if ! defined(Class['::supervisord']) {
class{ 'puphpet::python::pip': }
class { '::supervisord':
install_pip => false,
require => [
Class['::my_fw::post'],
Class['puphpet::python::pip'],
],
}
}
}

View File

@ -111,6 +111,23 @@ class { 'rabbitmq':
}
```
**NOTE:** If you are using a version of RabbitMQ less than 3.0,
you still need to use `x-ha-policy: all` in your client
applications for any particular queue to take advantage of H/A via
mirrored queues.
If you are using a version of RabbitMQ >= 3.0 You should set the
'config_mirrored_queues' parameter if you plan
on using RabbitMQ Mirrored Queues within your cluster:
```puppet
class { 'rabbitmq':
config_cluster => true,
config_mirrored_queues => true,
cluster_nodes => ['rabbit1', 'rabbit2'],
}
```
##Reference
##Classes
@ -234,6 +251,15 @@ Determines if the service is managed.
The name of the service to manage.
####`ssl`
Configures the service for using SSL.
####`ssl_only`
Configures the service to only use SSL. No cleartext TCP listeners will be created.
Requires that ssl => true also.
####`stomp_port`
The port to use for Stomp.
@ -262,6 +288,16 @@ rabbitmq_user { 'dan':
password => 'bar',
}
```
Optional parameter tags will set further rabbitmq tags like monitoring, policymaker, etc.
To set the administrator tag use admin-flag.
```puppet
rabbitmq_user { 'dan':
admin => true,
password => 'bar',
tags => ['monitoring', 'tag1'],
}
```
### rabbitmq\_vhost
@ -317,8 +353,8 @@ The module has been tested on:
Testing on other platforms has been light and cannot be guaranteed.
### RedHat module dependencies
To have a suitable erlang version installed on RedHat systems,
### Module dependencies
To have a suitable erlang version installed on RedHat and Debian systems,
you have to install another puppet module from http://forge.puppetlabs.com/garethr/erlang with:
puppet module install garethr-erlang
@ -326,9 +362,18 @@ you have to install another puppet module from http://forge.puppetlabs.com/garet
This module handles the packages for erlang.
To use the module, add the following snippet to your site.pp or an appropriate profile class:
For RedHat systems:
include 'erlang'
class { 'erlang': epel_enable => true}
For Debian systems:
include 'erlang'
package { 'erlang-base':
ensure => 'latest',
}
##Development
Puppet Labs modules on the Puppet Forge are open projects, and community

View File

@ -2,7 +2,9 @@ require 'puppet'
Puppet::Type.type(:rabbitmq_exchange).provide(:rabbitmqadmin) do
commands :rabbitmqctl => '/usr/sbin/rabbitmqctl'
commands :rabbitmqadmin => '/usr/local/bin/rabbitmqadmin'
has_command(:rabbitmqadmin, '/usr/local/bin/rabbitmqadmin') do
environment( { 'HOME' => '' })
end
defaultfor :feature => :posix
def should_vhost

View File

@ -1,10 +1,20 @@
Puppet::Type.type(:rabbitmq_plugin).provide(:rabbitmqplugins) do
if Puppet::PUPPETVERSION.to_f < 3
commands :rabbitmqplugins => 'rabbitmq-plugins'
if Facter.value(:osfamily) == 'RedHat'
commands :rabbitmqplugins => '/usr/lib/rabbitmq/bin/rabbitmq-plugins'
else
commands :rabbitmqplugins => 'rabbitmq-plugins'
end
else
has_command(:rabbitmqplugins, 'rabbitmq-plugins') do
environment :HOME => "/tmp"
if Facter.value(:osfamily) == 'RedHat'
has_command(:rabbitmqplugins, '/usr/lib/rabbitmq/bin/rabbitmq-plugins') do
environment :HOME => "/tmp"
end
else
has_command(:rabbitmqplugins, 'rabbitmq-plugins') do
environment :HOME => "/tmp"
end
end
end

View File

@ -27,6 +27,9 @@ Puppet::Type.type(:rabbitmq_user).provide(:rabbitmqctl) do
if resource[:admin] == :true
make_user_admin()
end
if !resource[:tags].nil?
set_user_tags(resource[:tags])
end
end
def destroy
@ -39,8 +42,18 @@ Puppet::Type.type(:rabbitmq_user).provide(:rabbitmqctl) do
end
end
# def password
# def password=()
def tags
get_user_tags.entries.sort
end
def tags=(tags)
if ! tags.nil?
set_user_tags(tags)
end
end
def admin
if usertags = get_user_tags
(:true if usertags.include?('administrator')) || :false
@ -49,7 +62,6 @@ Puppet::Type.type(:rabbitmq_user).provide(:rabbitmqctl) do
end
end
def admin=(state)
if state == :true
make_user_admin()
@ -60,6 +72,16 @@ Puppet::Type.type(:rabbitmq_user).provide(:rabbitmqctl) do
end
end
def set_user_tags(tags)
is_admin = get_user_tags().member?("administrator") \
|| resource[:admin] == :true
usertags = Set.new(tags)
if is_admin
usertags.add("administrator")
end
rabbitmqctl('set_user_tags', resource[:name], usertags.entries.sort)
end
def make_user_admin
usertags = get_user_tags
usertags.add('administrator')
@ -73,5 +95,4 @@ Puppet::Type.type(:rabbitmq_user).provide(:rabbitmqctl) do
end.compact.first
Set.new(match[1].split(/, /)) if match
end
end

View File

@ -33,6 +33,10 @@ Puppet::Type.newtype(:rabbitmq_user) do
defaultto :false
end
newproperty(:tags, :array_matching => :all) do
desc 'additional tags for the user'
end
validate do
if self[:ensure] == :present and ! self[:password]
raise ArgumentError, 'must set password when creating user' unless self[:password]

View File

@ -17,11 +17,14 @@ class rabbitmq::config {
$port = $rabbitmq::port
$service_name = $rabbitmq::service_name
$ssl = $rabbitmq::ssl
$ssl_only = $rabbitmq::ssl_only
$ssl_cacert = $rabbitmq::ssl_cacert
$ssl_cert = $rabbitmq::ssl_cert
$ssl_key = $rabbitmq::ssl_key
$ssl_management_port = $rabbitmq::ssl_management_port
$ssl_stomp_port = $rabbitmq::ssl_stomp_port
$ssl_verify = $rabbitmq::ssl_verify
$ssl_fail_if_no_peer_cert = $rabbitmq::ssl_fail_if_no_peer_cert
$stomp_port = $rabbitmq::stomp_port
$wipe_db_on_cookie_change = $rabbitmq::wipe_db_on_cookie_change
$config_variables = $rabbitmq::config_variables
@ -115,3 +118,4 @@ class rabbitmq::config {
}

View File

@ -6,6 +6,7 @@ class rabbitmq(
$cluster_nodes = $rabbitmq::params::cluster_nodes,
$config = $rabbitmq::params::config,
$config_cluster = $rabbitmq::params::config_cluster,
$config_mirrored_queues = $rabbitmq::params::config_mirrored_queues,
$config_path = $rabbitmq::params::config_path,
$config_stomp = $rabbitmq::params::config_stomp,
$default_user = $rabbitmq::params::default_user,
@ -29,6 +30,7 @@ class rabbitmq(
$service_manage = $rabbitmq::params::service_manage,
$service_name = $rabbitmq::params::service_name,
$ssl = $rabbitmq::params::ssl,
$ssl_only = $rabbitmq::params::ssl_only,
$ssl_cacert = $rabbitmq::params::ssl_cacert,
$ssl_cert = $rabbitmq::params::ssl_cert,
$ssl_key = $rabbitmq::params::ssl_key,
@ -59,7 +61,6 @@ class rabbitmq(
validate_string($package_gpg_key)
validate_string($package_name)
validate_string($package_provider)
validate_string($package_source)
validate_bool($manage_repos)
validate_re($version, '^\d+\.\d+\.\d+(-\d+)*$') # Allow 3 digits and optional -n postfix.
# Validate config parameters.
@ -69,6 +70,7 @@ class rabbitmq(
validate_string($config)
validate_absolute_path($config_path)
validate_bool($config_cluster)
validate_bool($config_mirrored_queues)
validate_bool($config_stomp)
validate_string($default_user)
validate_string($default_pass)
@ -87,6 +89,7 @@ class rabbitmq(
validate_bool($service_manage)
validate_string($service_name)
validate_bool($ssl)
validate_bool($ssl_only)
validate_string($ssl_cacert)
validate_string($ssl_cert)
validate_string($ssl_key)
@ -105,6 +108,10 @@ class rabbitmq(
validate_hash($config_variables)
validate_hash($config_kernel_variables)
if $ssl_only and ! $ssl {
fail('$ssl_only => true requires that $ssl => true')
}
include '::rabbitmq::install'
include '::rabbitmq::config'
include '::rabbitmq::service'

View File

@ -10,4 +10,10 @@ class rabbitmq::management {
}
}
if $rabbitmq::config_mirrored_queues {
rabbitmq::policy { 'ha-all':
pattern => '.*',
definition => '{"ha-mode":"all","ha-sync-mode":"automatic"}'
}
}
}

View File

@ -61,6 +61,7 @@ class rabbitmq::params {
$cluster_nodes = []
$config = 'rabbitmq/rabbitmq.config.erb'
$config_cluster = false
$config_mirrored_queues = false
$config_path = '/etc/rabbitmq/rabbitmq.config'
$config_stomp = false
$default_user = 'guest'
@ -73,6 +74,7 @@ class rabbitmq::params {
$plugin_dir = "/usr/lib/rabbitmq/lib/rabbitmq_server-${version}/plugins"
$port = '5672'
$ssl = false
$ssl_only = false
$ssl_cacert = 'UNSET'
$ssl_cert = 'UNSET'
$ssl_key = 'UNSET'

View File

@ -0,0 +1,15 @@
define rabbitmq::policy (
$pattern,
$definition,
$vhost = '/',
$priority = 0,
) {
exec { "rabbitmq policy: ${title}":
command => "rabbitmqctl set_policy -p ${vhost} '${name}' '${pattern}' '${definition}' ${priority}",
unless => "rabbitmqctl list_policies | grep -qE '^${vhost}\\s+${name}\\s+${pattern}\\s+${definition}\\s+${priority}$'",
path => ['/bin','/sbin','/usr/bin','/usr/sbin'],
require => Class['rabbitmq::service'],
before => Anchor['rabbitmq::end']
}
}

View File

@ -66,7 +66,7 @@ class rabbitmq::server(
}
if $config_mirrored_queues != undef {
warning('The $config_mirrored_queues parameter is deprecated; it does not affect anything')
warning('The $config_mirrored_queues parameter is deprecated in this class, use the rabbitmq class')
}
anchor {'before::rabbimq::class':

View File

@ -20,7 +20,7 @@ describe 'rabbitmq' do
let(:facts) {{ :osfamily => 'Debian' }}
it 'should add a repo with defaults values' do
contain_file('/etc/apt/sources.list.d/rabbitmq.list')\
.with_content(/deb http\:\/\/www\.rabbitmq.com\/debian\/ testing main/)
.with_content(%r|deb http\://www\.rabbitmq.com/debian/ testing main|)
end
end
@ -32,7 +32,7 @@ describe 'rabbitmq' do
}}
it 'should add a repo with custom new values' do
contain_file('/etc/apt/sources.list.d/rabbitmq.list')\
.with_content(/deb http\:\/\/www\.foorepo.com\/debian\/ unstable main/)
.with_content(%r|deb http\://www\.foorepo.com/debian/ unstable main|)
end
end
end
@ -275,6 +275,30 @@ describe 'rabbitmq' do
end
end
describe 'configuring ldap authentication' do
let :params do
{ :config_stomp => false,
:ldap_auth => true,
:ldap_server => 'ldap.example.com',
:ldap_user_dn_pattern => 'ou=users,dc=example,dc=com',
:ldap_use_ssl => false,
:ldap_port => '389',
:ldap_log => true
}
end
it { should contain_rabbitmq_plugin('rabbitmq_auth_backend_ldap') }
it 'should contain ldap parameters' do
verify_contents(subject, 'rabbitmq.config',
['[', ' {rabbit, [', ' {auth_backends, [rabbit_auth_backend_internal, rabbit_auth_backend_ldap]},', ' ]}',
' {rabbitmq_auth_backend_ldap, [', ' {other_bind, anon},',
' {servers, ["ldap.example.com"]},',
' {user_dn_pattern, "ou=users,dc=example,dc=com"},', ' {use_ssl, false},',
' {port, 389},', ' {log, true}'])
end
end
describe 'default_user and default_pass set' do
let(:params) {{ :default_user => 'foo', :default_pass => 'bar' }}
it 'should set default_user and default_pass to specified values' do
@ -295,10 +319,31 @@ describe 'rabbitmq' do
it 'should set ssl options to specified values' do
contain_file('rabbitmq.config').with({
'content' => /ssl_listeners, \[3141\].*
ssl_options, \[{cacertfile,"\/path\/to\/cacert".*
certfile="\/path\/to\/cert".*
keyfile,"\/path\/to\/key/,
'content' => %r|ssl_listeners, \[3141\].*
ssl_options, \[{cacertfile,"/path/to/cacert".*
certfile="/path/to/cert".*
keyfile,"/path/to/key|,
})
end
end
describe 'ssl options with ssl_only' do
let(:params) {
{ :ssl => true,
:ssl_only => true,
:ssl_management_port => 3141,
:ssl_cacert => '/path/to/cacert',
:ssl_cert => '/path/to/cert',
:ssl_key => '/path/to/key'
} }
it 'should set ssl options to specified values' do
contain_file('rabbitmq.config').with({
'content' => %r|tcp_listeners, \[\].*
ssl_listeners, \[3141\].*
ssl_options, \[{cacertfile,"/path/to/cacert".*
certfile="/path/to/cert".*
keyfile,"/path/to/key|,
})
end
end

View File

@ -147,4 +147,90 @@ EOT
@provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', ['bar','baz'].sort)
@provider.admin=:false
end
it 'should clear all tags on existing user' do
@provider.expects(:rabbitmqctl).with('list_users').returns <<-EOT
Listing users ...
one [administrator]
foo [tag1,tag2]
icinga [monitoring]
kitchen []
kitchen2 [abc, def, ghi]
...done.
EOT
@provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', [])
@provider.tags=[]
end
it 'should set multiple tags' do
@provider.expects(:rabbitmqctl).with('list_users').returns <<-EOT
Listing users ...
one [administrator]
foo []
icinga [monitoring]
kitchen []
kitchen2 [abc, def, ghi]
...done.
EOT
@provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', ['tag1','tag2'])
@provider.tags=['tag1','tag2']
end
it 'should clear tags while keep admin tag' do
@resource[:admin] = true
@provider.expects(:rabbitmqctl).with('list_users').returns <<-EOT
Listing users ...
one [administrator]
foo [administrator, tag1, tag2]
icinga [monitoring]
kitchen []
kitchen2 [abc, def, ghi]
...done.
EOT
@provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', ["administrator"])
@provider.tags=[]
end
it 'should change tags while keep admin tag' do
@resource[:admin] = true
@provider.expects(:rabbitmqctl).with('list_users').returns <<-EOT
Listing users ...
one [administrator]
foo [administrator, tag1, tag2]
icinga [monitoring]
kitchen []
kitchen2 [abc, def, ghi]
...done.
EOT
@provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', ["administrator","tag1","tag3","tag7"])
@provider.tags=['tag1','tag7','tag3']
end
it 'should create user with tags and without admin' do
@resource[:tags] = [ "tag1", "tag2" ]
@provider.expects(:rabbitmqctl).with('add_user', 'foo', 'bar')
@provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', ["tag1","tag2"])
@provider.expects(:rabbitmqctl).with('list_users').returns <<-EOT
Listing users ...
foo []
...done.
EOT
@provider.create
end
it 'should create user with tags and with admin' do
@resource[:tags] = [ "tag1", "tag2" ]
@resource[:admin] = true
@provider.expects(:rabbitmqctl).with('add_user', 'foo', 'bar')
@provider.expects(:rabbitmqctl).with('list_users').twice.returns <<-EOT
Listing users ...
foo []
...done.
EOT
@provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', ["administrator"])
@provider.expects(:rabbitmqctl).with('set_user_tags', 'foo', ["administrator","tag1","tag2"])
@provider.create
end
end

View File

@ -9,7 +9,10 @@
{cluster_nodes, {[<%= @r_cluster_nodes.map { |n| "\'rabbit@#{n}\'" }.join(', ') %>], <%= @cluster_node_type %>}},
{cluster_partition_handling, <%= @cluster_partition_handling %>},
<% end -%>
<%- if @ssl %>
<%- if @ssl_only -%>
{tcp_listeners, []},
<%- end -%>
<%- if @ssl -%>
{ssl_listeners, [<%= @ssl_management_port %>]},
{ssl_options, [{cacertfile,"<%= @ssl_cacert %>"},
{certfile,"<%= @ssl_cert %>"},
@ -37,6 +40,7 @@
{ssl_listeners, [<%= @ssl_stomp_port %>]}
<%- end -%>
]}
<% end -%>
<%- if @ldap_auth -%>,
% Configure the LDAP authentication plugin
{rabbitmq_auth_backend_ldap, [
@ -47,7 +51,6 @@
{port, <%= @ldap_port %>},
{log, <%= @ldap_log %>}
]}
<% end -%>
<%- end -%>
].
% EOF

View File

@ -0,0 +1,13 @@
name 'puppetlabs-sqlite'
version '0.0.1'
source 'https://github.com/puppetlabs/puppetlabs-sqlite/'
author 'puppetlabs'
license 'Apache'
summary 'Manage a sqlite installation and databases'
description 'This module provides a sqlite class to manage
the installation of sqlite on a node. It also provides
a sqlite::db defined type to manage databases on a system'
project_page 'http://projects.puppetlabs.com/projects/modules/issues'
## Add dependencies, if any:
# dependency 'username/name', '>= 1.2.0'

View File

@ -0,0 +1,32 @@
sqlite
======
Author: Carl Caum <carl@puppetlabs.com>
Copyright (c) 2011, Puppet Labs Inc.
ABOUT
=====
This module manages [sqlite](http://www.sqlite.org). Through declarion of the `sqlite` class, sqlite will be installed on the system.
The `sqlite::db` defined type allows for the management of a sqlite database on the node
CONFIGURATION
=============
The main class (sqlite) only needs to be declared. No class parameters or top scope variables are needed.
The `sqlite::db` defined type can be used to manage a sqlite database on the system.
The following parameters are available for the resources declaration:
location What directory the database should go in. The presence of the directory must be managed separately of the defined type.
owner The owner of the sqlite database file on disk
group The group owning the sqlite database file on disk
mode The mode of the sqlite database file on disk
ensure Whether the database should be `present` or `absent`. Default to `present`
sqlite_cmd The sqlite command for the node's platform. Defaults to `sqlite3`
TODO
====
* Allow for sql commands to be based to sqlite::db for use during creation

View File

@ -0,0 +1,44 @@
# Define: sqlite::db
#
# This define allows for managing the existance of a sqlite database
#
# Parameters:
# $location:
# The location on disk to store the sqlite database
# $owner:
# The owner of the sqlite database file on disk
# $group:
# The group owning the sqlite database file on disk
# $mode:
# The mode of the sqlite datbase file on disk
# $ensure:
# Whether the database should be `present` or `absent`. Defaults to `present`
# $sqlite_cmd:
# The sqlite command for the node's platform. Defaults to `sqlite3`
define sqlite::db(
$location = '',
$owner = 'root',
$group = 0,
$mode = '755',
$ensure = present,
$sqlite_cmd = 'sqlite3'
) {
$safe_location = $location ? {
'' => "/var/lib/sqlite/${name}.db",
default => $location,
}
file { $safe_location:
ensure => $ensure,
owner => $owner,
group => $group,
notify => Exec["create_${name}_db"],
}
exec { "create_${name}_db":
command => "${sqlite_cmd} $safe_location",
path => '/usr/bin:/usr/local/bin',
refreshonly => true,
}
}

View File

@ -0,0 +1,16 @@
# Class: sqlite
#
# This class manages the installation of the sqlite
# database.
#
# Sample Usage:
# class { 'sqlite': }
class sqlite {
package { 'sqlite':
ensure => installed,
}
file { '/var/lib/sqlite/':
ensure => directory,
}
}

View File

@ -0,0 +1,12 @@
/*
+-----------------------------------------------------------------------+
| |
| ==> DO NOT EDIT THIS FILE! <== |
| |
| You should edit the `Modulefile` and run `puppet-module build` |
| to generate the `metadata.json` file for your releases. |
| |
+-----------------------------------------------------------------------+
*/
{}

View File

@ -0,0 +1,6 @@
--format
s
--colour
--loadby
mtime
--backtrace

View File

@ -0,0 +1,18 @@
require 'pathname'
dir = Pathname.new(__FILE__).parent
$LOAD_PATH.unshift(dir, dir + 'lib', dir + '../lib')
require 'mocha'
require 'puppet'
gem 'rspec', '=1.2.9'
require 'spec/autorun'
Spec::Runner.configure do |config|
config.mock_with :mocha
end
# We need this because the RAL uses 'should' as a method. This
# allows us the same behaviour but with a different method name.
class Object
alias :must :should
end

View File

@ -0,0 +1 @@
include sqlite

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 B

After

Width:  |  Height:  |  Size: 162 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 166 B

After

Width:  |  Height:  |  Size: 165 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1009 B

After

Width:  |  Height:  |  Size: 1008 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1009 B

After

Width:  |  Height:  |  Size: 1008 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1009 B

After

Width:  |  Height:  |  Size: 1008 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 B

After

Width:  |  Height:  |  Size: 179 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 178 B

After

Width:  |  Height:  |  Size: 177 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 B

After

Width:  |  Height:  |  Size: 119 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 B

After

Width:  |  Height:  |  Size: 104 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 B

After

Width:  |  Height:  |  Size: 110 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 B

After

Width:  |  Height:  |  Size: 109 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 B

After

Width:  |  Height:  |  Size: 118 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 B

After

Width:  |  Height:  |  Size: 100 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Some files were not shown because too many files have changed in this diff Show More