Showing with 45 additions and 10 deletions.
  1. +9 −1 CHANGELOG.md
  2. +9 −0 REFERENCE.md
  3. +19 −7 manifests/config.pp
  4. +2 −0 manifests/init.pp
  5. +5 −1 manifests/install.pp
  6. +1 −1 metadata.json
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@ All notable changes to this project will be documented in this file.
Each new release typically also includes the latest modulesync defaults.
These should not affect the functionality of the module.

## [v12.0.0](https://github.com/voxpupuli/puppet-r10k/tree/v12.0.0) (2023-08-06)
## [v12.1.0](https://github.com/voxpupuli/puppet-r10k/tree/v12.1.0) (2023-08-09)

[Full Changelog](https://github.com/voxpupuli/puppet-r10k/compare/v12.0.0...v12.1.0)

**Implemented enhancements:**

- Implement global $ensure param to purge r10k [\#618](https://github.com/voxpupuli/puppet-r10k/pull/618) ([bastelfreak](https://github.com/bastelfreak))

## [v12.0.0](https://github.com/voxpupuli/puppet-r10k/tree/v12.0.0) (2023-08-07)

[Full Changelog](https://github.com/voxpupuli/puppet-r10k/compare/v11.0.1...v12.0.0)

Expand Down
9 changes: 9 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ The following parameters are available in the `r10k` class:
* [`forge_settings`](#-r10k--forge_settings)
* [`proxy`](#-r10k--proxy)
* [`pool_size`](#-r10k--pool_size)
* [`ensure`](#-r10k--ensure)
* [`remote`](#-r10k--remote)
* [`configfile`](#-r10k--configfile)
* [`version`](#-r10k--version)
Expand Down Expand Up @@ -143,6 +144,14 @@ Integer defining how many threads should be spawn while updating modules

Default value: `$facts['processors']['count']`

##### <a name="-r10k--ensure"></a>`ensure`

Data type: `Enum['absent','present']`

if r10k should be installed or purged

Default value: `'present'`

##### <a name="-r10k--remote"></a>`remote`

Data type: `Any`
Expand Down
26 changes: 19 additions & 7 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,24 @@
$source_keys = keys($r10k_sources)
}

$dir_ensure = $r10k::ensure ? {
'absent' => { ensure => 'absent', recurse => true, force => true },
'present' => { ensure => 'directory', },
}
$file_ensure = $r10k::ensure ? {
'absent' => 'absent',
'present' => 'file',
}
$link_ensure = $r10k::ensure ? {
'absent' => 'absent',
'present' => 'link',
}
if $r10k::configfile == '/etc/puppetlabs/r10k/r10k.yaml' {
file { '/etc/puppetlabs/r10k':
ensure => 'directory',
owner => $r10k::root_user,
group => $r10k::root_group,
mode => '0755',
owner => $r10k::root_user,
group => $r10k::root_group,
mode => '0755',
* => $dir_ensure,
}
}

Expand All @@ -43,7 +55,7 @@
'sources' => $r10k_sources,
}.delete_undef_values
file { 'r10k.yaml':
ensure => file,
ensure => $file_ensure,
owner => $r10k::root_user,
group => $r10k::root_group,
mode => '0644',
Expand All @@ -53,15 +65,15 @@

if $r10k::manage_configfile_symlink {
file { 'symlink_r10k.yaml':
ensure => 'link',
ensure => $link_ensure,
path => $r10k::configfile_symlink,
target => $r10k::configfile,
}
}

if $r10k::manage_modulepath {
ini_setting { 'R10k Modulepath':
ensure => present,
ensure => $r10k::ensure,
path => "${r10k::puppetconf_path}/puppet.conf",
section => 'main',
setting => 'modulepath',
Expand Down
2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# @param forge_settings Hash containing settings for downloading modules from the Puppet Forge
# @param proxy String containing proxy setting for r10k.yaml
# @param pool_size Integer defining how many threads should be spawn while updating modules
# @param ensure if r10k should be installed or purged
class r10k (
$remote = $r10k::params::remote,
Optional[Hash] $sources = undef,
Expand Down Expand Up @@ -38,6 +39,7 @@
Boolean $include_prerun_command = false,
Boolean $include_postrun_command = false,
Stdlib::Absolutepath $puppetconf_path = $r10k::params::puppetconf_path,
Enum['absent','present'] $ensure = 'present',
) inherits r10k::params {
# Check if user is declaring both classes
# Other classes like r10k::webhook is supported but
Expand Down
6 changes: 5 additions & 1 deletion manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@

# Puppet Enterprise 3.8 and ships an embedded r10k so thats all thats supported
# This conditional should not effect FOSS customers based on the fact
$ensure = $r10k::ensure ? {
'present' => $r10k::version,
'absent' => 'absent',
}
package { $r10k::package_name:
ensure => $r10k::version,
ensure => $ensure,
provider => $r10k::provider,
source => $r10k::gem_source,
install_options => $provider_install_options,
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"author": "Vox Pupuli",
"license": "Apache-2.0",
"name": "puppet-r10k",
"version": "12.0.0",
"version": "12.1.0",
"operatingsystem_support": [
{
"operatingsystem": "RedHat",
Expand Down