Hiera in-motion

13
Introduction to Hiera & Basic Hiera Data Structures David Kramer, RHCA Sr. DevOps Manager

description

Introduction to Hiera and Hiera Data Structures. I presented this as the DevOps Tech In Motion Meetup in San Francisco on 9/26.

Transcript of Hiera in-motion

Page 1: Hiera in-motion

Introduction to Hiera &Basic Hiera Data Structures

David Kramer, RHCA

Sr. DevOps Manager

Page 2: Hiera in-motion

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

Page 3: Hiera in-motion

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!

Page 4: Hiera in-motion

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

Page 5: Hiera in-motion

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’ )

Page 6: Hiera in-motion

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}

Page 7: Hiera in-motion

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

Page 8: Hiera in-motion

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’)

Page 9: Hiera in-motion

9 © Jive confidential

Yaml Data Structure Examples

• Yaml Variable:

• Yaml Array:

Page 10: Hiera in-motion

10 © Jive confidential

Yaml Data Structure Examples

• Yaml Hash:

Page 11: Hiera in-motion

11 © Jive confidential

Hooking your Yaml into your Puppet

• Tying all of this together by making your Puppet Class Hiera aware:

Page 12: Hiera in-motion

12 © Jive confidential

Questions?