Merge pull request #552 from boxen/hiera-and-module-data

Hiera and module data
This commit is contained in:
David Goodlad 2014-04-01 10:08:27 +11:00
commit 5c0a6c485a
4 changed files with 76 additions and 1 deletions

View file

@ -31,6 +31,10 @@ end
github "boxen", "3.4.2"
# Support for default hiera data in modules
github "module-data", "0.0.3", :repo => "ripienaa/puppet-module-data"
# Core modules for a basic development environment. You can replace
# some/most of these if you want, but it's not recommended.
@ -42,7 +46,6 @@ github "go", "1.1.0"
github "homebrew", "1.6.1"
github "hub", "1.3.0"
github "inifile", "1.0.3", :repo => "puppetlabs/puppetlabs-inifile"
github "module-data", "0.0.3", :repo => "ripienaar/puppet-module-data"
github "nginx", "1.4.3"
github "nodejs", "3.6.0"
github "openssl", "1.0.0"

View file

@ -207,6 +207,32 @@ Now Puppet knows where to download the module from when you include it in your s
# github "java", "1.1.0"
include java
### Hiera
Hiera is preferred mechanism to make changes to module defaults (e.g. default
global ruby version, service ports, etc). This repository supplies a
starting point for your Hiera configuration at `config/hiera.yml`, and an
example data file at `hiera/common.yaml`. See those files for more details.
The default `config/hiera.yml` is configured with a hierarchy that allows
individuals to have their own hiera data file in
`hiera/users/{github_login}.yaml` which augments and overrides
site-wide values in `hiera/common.yaml`. This default is, as with most of the
configuration in the example repo, a great starting point for many
organisations, but is totally up to you. You might want to, for
example, have a set of values that can't be overridden by adding a file to
the top of the hierarchy, or to have values set on specific OS
versions:
```yaml
# ...
:hierarchy:
- "global-overrides.yaml"
- "users/%{::github_login}"
- "osx-%{::macosx_productversion_major}"
- common
```
### Node definitions
Puppet has the concept of a

View file

@ -1 +1,24 @@
---
# This file configures the hiera "database" for Boxen. As with most files in
# this repo, it's just an example, and you should feel free to make any
# changes suited to your organisation.
# The defaults here should give you a solid start; put global defaults in
# a file named hiera/common.yaml, and individuals can supplement and/or override
# them in hiera/{github_login}.yaml
:backends:
- yaml
:yaml:
:datadir: "%{::boxen_home}/repo/hiera"
:hierarchy:
- "users/%{github_login}"
- common
# Many modules make their own hiera data available through the use of
# puppet-module-data. Some depend on the 'deeper' merge_behavior setting, so
# remove it at your own risk!
# ...
# besides the modules that use it, you might want to override deeply nested hash
# values, too!
:merge_behavior: deeper

23
hiera/common.yaml.example Normal file
View file

@ -0,0 +1,23 @@
---
# This is an example of the kinds of things that you can configure via hiera.
# If you've left the defaults in `/hiera.yml`, you might want to copy this file
# to `hiera/common.yaml`, or feel free to start with a blank slate!
# Have a gander at some of these examples to get an idea of some of the things
# that you can affect 'out of the box', and then customise to your
# heart's content.
# See https://github.com/boxen/puppet-ruby for docs
ruby::global::version: "2.1.0"
ruby::rbenv_plugins:
rbenv-vars:
ensure: v1.0.0
source: sstephenson/rbenv-vars
ruby-build:
ensure: v20131225.1
source: sstephenson/ruby-build
ruby::version::alias:
2.0.0: 2.0.0-p353
# See https://github.com/boxen/puppet-java for docs
java::update_version: 51