Showing with 50 additions and 24 deletions.
  1. +8 −2 CHANGELOG.md
  2. +2 −2 README.md
  3. +8 −4 manifests/init.pp
  4. +21 −8 manifests/params.pp
  5. +8 −5 metadata.json
  6. +3 −3 templates/hiera.yaml.erb
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# Change log
All notable changes to this project will be documented in this file.

## [Unreleased][unreleased]
## [1.3.0] - 2015-07-23
### Features:
- Add PE 3.8 support
- Add Puppet 4 support

### Bugfixes:
- Fix `eyaml_datadir` parameter default to `datadir` value
- Handle cmdpath on different versions of puppet

## [1.2.0] - 2015-03-05
### Features:
Expand Down Expand Up @@ -64,7 +70,7 @@ All notable changes to this project will be documented in this file.
### Bugfixes:
- Only ensure datadir if it does not have `%{.*}`

[unreleased]: https://github.com/hunner/puppet-hiera/compare/1.2.0...master
[1.3.0]: https://github.com/hunner/puppet-hiera/compare/1.2.0...1.3.0
[1.2.0]: https://github.com/hunner/puppet-hiera/compare/1.1.1...1.2.0
[1.1.1]: https://github.com/hunner/puppet-hiera/compare/1.1.0...1.1.1
[1.1.0]: https://github.com/hunner/puppet-hiera/compare/1.0.2...1.1.0
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ The resulting output in /etc/puppet/hiera.yaml:
## Reference
This module will also allow you to configure different options for logger and merge_behaviour. The default behaviour is to set logger to console and merge behaviour to native.
For details and valid options [Configuring Hiera][https://docs.puppetlabs.com/hiera/1/configuring.html#global-settings].
For details and valid options see [Configuring Hiera](https://docs.puppetlabs.com/hiera/1/configuring.html#global-settings).
Note: For `merge_behavior` if you set deep or deeper you need to ensure the deep_merge Ruby gem is installed.

Expand Down Expand Up @@ -114,7 +114,7 @@ The following parameters are available for the hiera class:
* `hierarchy`
The hiera hierarchy.
Default: `[]`
* `backend`
* `backends`
The list of backends.
Default: `['yaml']`
* `hiera_yaml`
Expand Down
12 changes: 8 additions & 4 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#
# === Requires:
#
# Nothing.
# puppetlabs-stdlib >= 4.3.1
#
# === Sample Usage:
#
Expand Down Expand Up @@ -47,11 +47,11 @@
$owner = $hiera::params::owner,
$group = $hiera::params::group,
$eyaml = false,
$eyaml_datadir = $hiera::params::datadir,
$eyaml_datadir = undef,
$eyaml_extension = undef,
$confdir = $hiera::params::confdir,
$logger = 'console',
$cmdpath = ['/opt/puppet/bin', '/usr/bin', '/usr/local/bin'],
$cmdpath = $hiera::params::cmdpath,
$create_keys = true,
$gem_source = undef,
$eyaml_version = undef,
Expand All @@ -75,14 +75,18 @@
}
if $eyaml {
require hiera::eyaml
$eyaml_real_datadir = empty($eyaml_datadir) ? {
false => $eyaml_datadir,
true => $datadir,
}
}
# Template uses:
# - $eyaml
# - $backends
# - $logger
# - $hierarchy
# - $datadir
# - $eyaml_datadir
# - $eyaml_real_datadir
# - $eyaml_extension
# - $confdir
# - $merge_behavior
Expand Down
29 changes: 21 additions & 8 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,36 @@
# Copyright (C) 2013 Mike Arnold, unless otherwise noted.
#
class hiera::params {
if $::puppetversion =~ /Puppet Enterprise/ {
if str2bool($::is_pe) {
$hiera_yaml = '/etc/puppetlabs/puppet/hiera.yaml'
$datadir = '/etc/puppetlabs/puppet/hieradata'
$owner = 'pe-puppet'
$group = 'pe-puppet'
$confdir = '/etc/puppetlabs/puppet'
if $::puppetversion =~ /3.7/ {
$cmdpath = ['/opt/puppet/bin', '/usr/bin', '/usr/local/bin']


if versioncmp($::pe_version, '3.7.0') >= 0 {
$provider = 'pe_puppetserver_gem'
} else {
}
else {
$provider = 'pe_gem'
}
} else {
$hiera_yaml = '/etc/puppet/hiera.yaml'
$datadir = '/etc/puppet/hieradata'
}
else {
if versioncmp($::puppetversion, '4.0.0') >= 0 {
# Configure for AIO packaging.
$provider = 'puppet_gem'
$confdir = '/etc/puppetlabs/code'
$cmdpath = ['/opt/puppetlabs/puppet/bin', '/usr/bin', '/usr/local/bin']
} else {
$provider = 'gem'
$confdir = '/etc/puppet'
$cmdpath = ['/usr/bin', '/usr/local/bin']
}
$hiera_yaml = "${confdir}/hiera.yaml"
$datadir = "${confdir}/hieradata"
$owner = 'puppet'
$group = 'puppet'
$provider = 'gem'
$confdir = '/etc/puppet'
}
}
13 changes: 8 additions & 5 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hunner-hiera",
"version": "1.2.0",
"version": "1.3.0",
"author": "hunner",
"summary": "Deploy hiera.yaml with hierarchy, and datadir",
"license": "BSD-2-Clause",
Expand All @@ -10,14 +10,17 @@
"requirements": [
{
"name": "pe",
"version_requirement": ">= 3.0.0 < 3.7.0"
"version_requirement": ">= 3.0.0 < 2015.3.0"
},
{
"name": "puppet",
"version_requirement": "3.x"
"version_requirement": ">= 3.0.0 < 5.0.0"
}
],
"dependencies": [

"dependencies": [
{
"name": "puppetlabs-stdlib",
"version_range": ">= 4.3.1"
}
]
}
6 changes: 3 additions & 3 deletions templates/hiera.yaml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ end -%>
:yaml:
:datadir: <%= @datadir %>
<% if @eyaml %>
<% if @eyaml -%>
:eyaml:
:datadir: <%= @eyaml_datadir %>
:datadir: <%= @eyaml_real_datadir %>
<% if @eyaml_extension -%>
:extension: <%= @eyaml_extension %>
<% end -%>
:pkcs7_private_key: <%= @confdir %>/keys/private_key.pkcs7.pem
:pkcs7_public_key: <%= @confdir %>/keys/public_key.pkcs7.pem
<% end %>
<% end -%>
<% if @merge_behavior -%>
:merge_behavior: <%= @merge_behavior -%>
Expand Down