Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manage puppet.conf's $modulepath #4

Merged
merged 8 commits into from
Aug 23, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
}
}
}
31 changes: 18 additions & 13 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# 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' :
Expand All @@ -21,9 +23,12 @@
}

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,
}
}
35 changes: 17 additions & 18 deletions manifests/params.pp
Original file line number Diff line number Diff line change
@@ -1,42 +1,41 @@
class r10k::params
{
$version = '1.0.0'
$version = '1.0.0'
$manage_modulepath = true

$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"

}