Showing with 16 additions and 0 deletions.
  1. +8 −0 manifests/config.pp
  2. +2 −0 manifests/init.pp
  3. +1 −0 manifests/params.pp
  4. +5 −0 templates/r10k.yaml.erb
8 changes: 8 additions & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
# * [*sources*]
# Hash containing data sources to be used by r10k to create dynamic Puppet
# environments. Default: {}
# * [*purgedirs*]
# An Array of directory paths to purge of any subdirectories that do not
# correspond to a dynamic environment managed by r10k. Default: []
# * [*manage_configfile_symlink*]
# Boolean to determine if a symlink to the r10k config file is to be managed.
# Default: false
Expand All @@ -29,6 +32,10 @@
# 'basedir' => '/some/other/basedir'
# },
# },
# purgedirs => [
# "${::settings::confdir}/environments",
# '/some/other/basedir',
# ],
# }
#
# == Documentation
Expand All @@ -46,6 +53,7 @@
$modulepath = undef,
$remote = '',
$sources = 'UNSET',
$purgedirs = [],
$puppetconf_path = $r10k::params::puppetconf_path,
$r10k_basedir = $r10k::params::r10k_basedir,
$manage_configfile_symlink = $r10k::params::manage_configfile_symlink,
Expand Down
2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
class r10k (
$remote = $r10k::params::remote,
$sources = $r10k::params::sources,
$purgedirs = $r10k::params::r10k_purgedirs,
$cachedir = $r10k::params::r10k_cache_dir,
$configfile = $r10k::params::r10k_config_file,
$version = $r10k::params::version,
Expand Down Expand Up @@ -46,6 +47,7 @@
cachedir => $cachedir,
configfile => $configfile,
sources => $sources,
purgedirs => $purgedirs,
modulepath => $modulepath,
remote => $remote,
manage_modulepath => $manage_modulepath,
Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
$r10k_config_file = '/etc/r10k.yaml'
$r10k_cache_dir = '/var/cache/r10k'
$r10k_basedir = "${::settings::confdir}/environments"
$r10k_purgedirs = $r10k_basedir
$manage_configfile_symlink = false
$configfile_symlink = '/etc/r10k.yaml'

Expand Down
5 changes: 5 additions & 0 deletions templates/r10k.yaml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@
<% end -%>
<% end -%>
<% end %>
<%# The Array boxing/flattening ensures we don't get bitten by bug #15813 -%>
<% unless [@purgedirs].flatten.empty? -%>
:purgedirs:
<%= [@purgedirs].flatten.to_yaml.split("\n")[1..-1].join("\n") %>
<% end -%>