Showing with 107 additions and 71 deletions.
  1. +6 −0 CHANGELOG
  2. +6 −5 Modulefile
  3. +17 −0 manifests/config.pp
  4. +20 −15 manifests/init.pp
  5. +10 −0 manifests/install.pp
  6. +12 −0 manifests/install/pe_ruby.pp
  7. +9 −17 manifests/{ → install}/ruby.pp
  8. +1 −0 manifests/mcollective.pp
  9. +18 −18 manifests/params.pp
  10. +0 −11 manifests/pe_ruby.pp
  11. +4 −1 manifests/prerun_command.pp
  12. +1 −1 templates/etc/r10k.yaml.erb
  13. +3 −3 tests/init.pp
6 changes: 6 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2013-08-25 - Zack Smith <zack@puppetlabs.vom> - 0.0.5
* Lint and Syntax updates + Forge Release
2013-08-17 - Zack Smith <zack@puppetlabs.com> - 0.0.4
* RC1 of new sources code
2013-08-15 - Zack Smith <zack@puppetlabs.com> - 0.0.3
* Allow for multiple sources
2013-07-11 - Zack Smith <zack@puppetlabs.com> - 0.0.2
* Restrict installed version of r10k to 0.0.9
2013-06-12 - Zack Smith <zack@puppetlabs.com> - 0.0.1
Expand Down
11 changes: 6 additions & 5 deletions Modulefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ description 'Module for setting up dynamic environments using r10k'
project_page 'https://github.com/acidprime/r10k'

## Add dependencies, if any:
dependency 'puppetlabs/stdlib', '>= 4.1.0'
dependency 'puppetlabs/ruby', '>= 0.0.2'
dependency 'puppetlabs/gcc', '>= 0.0.3'
dependency 'puppetlabs/pe_gem', '>= 0.0.1'
dependency 'mhuffnagle/make', '>= 0.0.1'
dependency 'puppetlabs/stdlib', '>= 4.1.0'
dependency 'puppetlabs/ruby', '>= 0.0.2'
dependency 'puppetlabs/gcc', '>= 0.0.3'
dependency 'puppetlabs/pe_gem', '>= 0.0.1'
dependency 'mhuffnagle/make', '>= 0.0.1'
dependency 'puppetlabs/inifile', '>= 1.0.0'
17 changes: 17 additions & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
$cachedir,
$sources = {},
$purgedirs = [],
$r10k_basedir,
$modulepath,
$manage_modulepath,
) {
file { 'r10k.yaml':
ensure => file,
Expand All @@ -55,4 +58,18 @@
content => template("${module_name}/${configfile}.erb"),
}

$puppetconf_path = $::is_pe ? {
'true' => '/etc/puppetlabs/puppet',
default => '/etc/puppet',
}

if $manage_modulepath {
ini_setting { "R10k Modulepath":
path => "${puppetconf_path}/puppet.conf",
section => 'main',
setting => 'modulepath',
value => $modulepath,
ensure => present,
}
}
}
35 changes: 20 additions & 15 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,29 +1,34 @@
# This class configures r10k
class r10k (
$sources = {},
$remote = $r10k::params::remote,
$source_name = $r10k::params::source_name,
$purgedirs = $r10k::params::r10k_purgedirs,
$basedir = $r10k::params::r10k_basedir,
$cachedir = $r10k::params::r10k_cache_dir,
$configfile = $r10k::params::r10k_config_file,
$version = $r10k::params::version,
$pe_ruby = $r10k::params::pe_ruby,
$sources = {},
$remote = $r10k::params::remote,
$source_name = $r10k::params::source_name,
$purgedirs = $r10k::params::r10k_purgedirs,
$basedir = $r10k::params::r10k_basedir,
$cachedir = $r10k::params::r10k_cache_dir,
$configfile = $r10k::params::r10k_config_file,
$version = $r10k::params::version,
$pe_ruby = $r10k::params::pe_ruby,
$modulepath = $r10k::params::modulepath,
$manage_modulepath = $r10k::params::manage_modulepath,
) inherits r10k::params {
if $pe_ruby {
class { 'r10k::pe_ruby' :
class { 'r10k::install::pe_ruby' :
version => $version,
}
} else {
class { 'r10k::ruby' :
class { 'r10k::install::ruby' :
version => $version,
}
}

class { 'r10k::config':
cachedir => $cachedir,
configfile => $configfile,
sources => $sources,
purgedirs => $purgedirs,
cachedir => $cachedir,
configfile => $configfile,
sources => $sources,
purgedirs => $purgedirs,
r10k_basedir => $basedir,
modulepath => $modulepath,
manage_modulepath => $manage_modulepath,
}
}
10 changes: 10 additions & 0 deletions manifests/install.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This class is used by the ruby or pe_ruby class
class r10k::install (
$version,
$provider = 'gem',
) {
package { 'r10k':
ensure => $version,
provider => $provider,
}
}
12 changes: 12 additions & 0 deletions manifests/install/pe_ruby.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Install r10k using the pe_gem provider
class r10k::install::pe_ruby (
$version,
) {
require gcc
require make

class { 'r10k::install':
version => $version,
provider => 'pe_gem',
}
}
26 changes: 9 additions & 17 deletions manifests/ruby.pp → manifests/install/ruby.pp
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
class r10k::ruby(
# Install the r10k gem using system ruby
class r10k::install::ruby(
$version,
) {
# Install the r10k dependacies
require gcc
require make

# Breaking up my chaining a little here
Class['::ruby'] -> Class['ruby::dev'] -> Package['gcc']

Expand All @@ -17,22 +22,9 @@
# ruby::dev class would have taken care of it
Package['gcc'] -> Package['make'] -> Package['r10k']

# Install the r10k gem & dependacies
# Check for gcc and make as they might already be in the catalog
if ! defined(Package['gcc']) {
package { 'gcc':
ensure => installed,
}
}

if ! defined(Package['make']) {
package { 'make':
ensure => present,
}
}

package { 'r10k':
ensure => $version,
class { 'r10k::install':
version => $version,
provider => 'gem',
}

}
1 change: 1 addition & 0 deletions manifests/mcollective.pp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Install the r10k mcollective agent
class r10k::mcollective(
$agent_name = $r10k::params::mc_agent_name,
$app_name = $r10k::params::mc_app_name,
Expand Down
36 changes: 18 additions & 18 deletions manifests/params.pp
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
# Reasonable defaults for all classes
class r10k::params
{
$version = '1.0.0'
$version = '1.0.0'
$manage_modulepath = false

$pe_ruby = $::is_pe ? {
'true' => true,
'false' => false,
}
# r10k configuration
$r10k_config_file = '/etc/r10k.yaml'
$r10k_cache_dir = '/var/cache/r10k'
$r10k_basedir = "${::settings::confdir}/environments"
$r10k_purgedirs = $r10k_basedir

# Git configuration
$git_server = $::settings::ca_server
$repo_path = '/var/repos'
$remote = "ssh://${git_server}${repo_path}/modules.git"
$source_name = 'jiminy'

# Puppet Enterprise specific settings
if $::is_pe == 'true' {
# Mcollective configuration dynamic
$mc_service_name = 'pe-mcollective'
$plugins_dir = '/opt/puppet/libexec/mcollective/mcollective'
$modulepath = "${r10k_basedir}/\$environment/modules:/opt/puppet/share/puppet/modules"
$pe_ruby = true
} else {
# Getting ready for FOSS support in this module

# Mcollective configuration dynamic
$mc_service_name = 'mcollective'
$plugins_dir = '/usr/libexec/mcollective/mcollective'
$modulepath = "${r10k_basedir}/\$environment/modules"
$pe_ruby = false
}

# r10k configuration
$r10k_config_file = '/etc/r10k.yaml'
$r10k_cache_dir = '/var/cache/r10k'
$r10k_basedir = "${::settings::confdir}/environments"
$r10k_purgedirs = $r10k::params::r10k_basedir

# Git configuration
$git_server = $::settings::ca_server
$repo_path = '/var/repos'
$remote = "ssh://${git_server}${repo_path}/modules.git"
$source_name = 'jiminy'

# Mcollective configuration static
$mc_agent_name = "${module_name}.rb"
$mc_agent_ddl_name = "${module_name}.ddl"
$mc_app_name = "${module_name}.rb"
$mc_agent_path = "${plugins_dir}/agent"
$mc_application_path = "${plugins_dir}/application"

}
11 changes: 0 additions & 11 deletions manifests/pe_ruby.pp

This file was deleted.

5 changes: 4 additions & 1 deletion manifests/prerun_command.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
class r10k::prerun_command {
# This class will configure r10k to run as part of the masters agent run
class r10k::prerun_command (
$command = 'r10k synchronize'
){
augeas{'puppet.conf prerun_command' :
context => '/files//puppet.conf/agent',
changes => "set prerun_command 'r10k synchronize'",
Expand Down
2 changes: 1 addition & 1 deletion templates/etc/r10k.yaml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
basedir: <%= @basedir %>
<% else -%>
:sources:
<%# The splitting/joining monkeybuisness trims the YAML document header: `---` -%>
<%# The splitting/joining monkeybusiness trims the YAML document header: `---` -%>
<%= @sources.to_yaml.split("\n")[1..-1].join("\n") %>
<% end %>
<%# The Array boxing/flattening ensures we don't get bitten by bug #15813 -%>
Expand Down
6 changes: 3 additions & 3 deletions tests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
#
class { 'r10k':
pe_ruby => false,
sources => {
sources => {
'puppet' => {
'remote' => 'git@github.com:acidprime/puppet.git',
'basedir' => "${::settings::confdir}/environments"
},
'hiera' => {
'hiera' => {
'remote' => 'git@github.com:acidprime/hiera.git',
'basedir' => "${::settings::confdir}/hiera"
},
},
purgedirs => [
purgedirs => [
"${::settings::confdir}/environments",
"${::settings::confdir}/hiera",
],
Expand Down