Introduction to Hiera &
Basic Hiera Data
Structures
David Kramer, RHCA
Sr. DevOps Manager
2 © Jive confidential
Introduction to Hiera Agenda
• Quick intro about myself
• What is this presentation and what isn’t it?
• Overview of Puppet
• Overview of Hiera
• Overview of Hiera Data Structures
• Tying it all together
3 © Jive confidential
Overview of Puppet
• What is Puppet?
– Should I mention facter?
• How do we manage nodes in Puppet?
– Every node always gets a node object
• Nodes.pp
• ENC
– Node_terminus
• Hiera
• Common question Im asked, can you have
multiple ENC’s? Yes you can!
4 © Jive confidential
What is Hiera?
• Hiera is a Key/Pair lookup tool
• Provides an Environment Hierarchy within
your data roles
• Reduces data repetition
– Write data for most scenarios
– Allows you to focus on difference data!
• Allows you to specify node specific data
– Provides Hierarchical Overriding
5 © Jive confidential
Brief Installation Overview of Hiera
• Package Info
– Hiera Gem
– Puppet 2.7.x needs hiera-puppet package installed.
– Puppet 3.0+ does not need hiera-puppet, hiera is
native!
• /etc/puppet/hiera.yaml
– Role Hierarchy definitions
• Modify your sites.pp to be hiera aware!
– classes: - hiera_include('classes')
– parameterized_classes: –
hiera_hash(‘parameterized_classes’ )
6 © Jive confidential
Walking thru the hiera.yaml
• :backends:
– Yaml
– Json
• :datadir:
– :yaml /etc/puppet/hieradata
• :gpg:
– Tired of storing secret information in the clear?
• :hierarchy:
– %{::clientcert}
– roles/%{role}
7 © Jive confidential
Hierarchy for your Environments
• Meta Data, Meta Data, Meta Data
– Custom Facts using Facter.add
• This is all up to you!!
• Some Jivin examples:
– Data Center
– Deployment Environment –Your SDLC!
– Roles
8 © Jive confidential
Overview of Hiera Data Structures
• Hiera Variable
– hiera(‘variable name’,’empty’)
• Hiera Array
– hiera_array( ‘array name’, ‘empty’)
• Hiera Hashes
– hiera_hash(‘hash name’, ‘empty’)
9 © Jive confidential
Yaml Data Structure Examples
• Yaml Variable:
• Yaml Array:
10 © Jive confidential
Yaml Data Structure Examples
• Yaml Hash:
11 © Jive confidential
Hooking your Yaml into your Puppet 
• Tying all of this together by making your
Puppet Class Hiera aware:
12 © Jive confidential
Questions?
13 © Jive confidential
http://docs.puppetlabs.
com/hiera/1/index.html
http://www.yaml.org/YA
ML_for_ruby.html#sim
ple_sequence
Resources

Hiera in-motion

  • 1.
    Introduction to Hiera& Basic Hiera Data Structures David Kramer, RHCA Sr. DevOps Manager
  • 2.
    2 © Jiveconfidential Introduction to Hiera Agenda • Quick intro about myself • What is this presentation and what isn’t it? • Overview of Puppet • Overview of Hiera • Overview of Hiera Data Structures • Tying it all together
  • 3.
    3 © Jiveconfidential Overview of Puppet • What is Puppet? – Should I mention facter? • How do we manage nodes in Puppet? – Every node always gets a node object • Nodes.pp • ENC – Node_terminus • Hiera • Common question Im asked, can you have multiple ENC’s? Yes you can!
  • 4.
    4 © Jiveconfidential What is Hiera? • Hiera is a Key/Pair lookup tool • Provides an Environment Hierarchy within your data roles • Reduces data repetition – Write data for most scenarios – Allows you to focus on difference data! • Allows you to specify node specific data – Provides Hierarchical Overriding
  • 5.
    5 © Jiveconfidential Brief Installation Overview of Hiera • Package Info – Hiera Gem – Puppet 2.7.x needs hiera-puppet package installed. – Puppet 3.0+ does not need hiera-puppet, hiera is native! • /etc/puppet/hiera.yaml – Role Hierarchy definitions • Modify your sites.pp to be hiera aware! – classes: - hiera_include('classes') – parameterized_classes: – hiera_hash(‘parameterized_classes’ )
  • 6.
    6 © Jiveconfidential Walking thru the hiera.yaml • :backends: – Yaml – Json • :datadir: – :yaml /etc/puppet/hieradata • :gpg: – Tired of storing secret information in the clear? • :hierarchy: – %{::clientcert} – roles/%{role}
  • 7.
    7 © Jiveconfidential Hierarchy for your Environments • Meta Data, Meta Data, Meta Data – Custom Facts using Facter.add • This is all up to you!! • Some Jivin examples: – Data Center – Deployment Environment –Your SDLC! – Roles
  • 8.
    8 © Jiveconfidential Overview of Hiera Data Structures • Hiera Variable – hiera(‘variable name’,’empty’) • Hiera Array – hiera_array( ‘array name’, ‘empty’) • Hiera Hashes – hiera_hash(‘hash name’, ‘empty’)
  • 9.
    9 © Jiveconfidential Yaml Data Structure Examples • Yaml Variable: • Yaml Array:
  • 10.
    10 © Jiveconfidential Yaml Data Structure Examples • Yaml Hash:
  • 11.
    11 © Jiveconfidential Hooking your Yaml into your Puppet  • Tying all of this together by making your Puppet Class Hiera aware:
  • 12.
    12 © Jiveconfidential Questions?
  • 13.
    13 © Jiveconfidential http://docs.puppetlabs. com/hiera/1/index.html http://www.yaml.org/YA ML_for_ruby.html#sim ple_sequence Resources