diff --git a/Modulefile b/Modulefile index 008cc714..014fe38f 100644 --- a/Modulefile +++ b/Modulefile @@ -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' diff --git a/manifests/config.pp b/manifests/config.pp index 74243e59..83f09e3a 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -46,6 +46,9 @@ $cachedir, $sources = {}, $purgedirs = [], + $r10k_basedir, + $modulepath, + $manage_modulepath, ) { file { 'r10k.yaml': ensure => file, @@ -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, + } + } } diff --git a/manifests/init.pp b/manifests/init.pp index 562c66b5..d2633b4b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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' : @@ -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, } } diff --git a/manifests/params.pp b/manifests/params.pp index 2a36fa73..30b4276f 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -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" - }