SlideShare a Scribd company logo
Manageable Puppet
infrastructure
~April 2014 edition~
PuppetCampBerlin
Ger Apeldoorn - http://puppetspecialist.nl
1 / 44
Freelance PuppetConsultant
TrainerforPuppetLabs Benelux
Who's this?
2 / 44
Scope
Also... why this talk?
3 / 44
Common
pitfalls
4 / 44
Pitfalls
Cause & effect
Pitfalls
Lots of Workarounds
Unmaintainable codebase
Collaboration difficulties
5 / 44
Pitfalls
Cause & effect
Quick Wins
Fix your codebase!
Quick wins:
Move data to Hiera
Implement Code Review
Use Puppet-lint in a git-hook
REFACTOR CONSTANTLY
6 / 44
A Manageable Design
April 2014 edition
7 / 44
Requirements
Whadda we need
8 / 44
Our environment should be:
Easyto Use
Easyto Comprehend
Easyto Update
and...Safe
9 / 44
This stuff
isn't exactly
easy
10 / 44
But we cán make it safe and
manageable
11 / 44
Requirements
Easyto:
Use
Comprehend
Update
Safe
Safe
Useenvironments to test everything
Createahugetesting environment
UseGit to promoteyour code
12 / 44
Requirements
Easyto:
Use
Comprehend
Update
Safe
Manageable
Manageable
Keepaconsistent modulestructure
Using roles for abstraction
Facilitatecollaboration
13 / 44
Domains
Server Roles
All things data
Deployment &Workflow
14 / 44
Overview
Software Components
15 / 44
Software Components
Puppet Enterpriseor TheForeman
Hieraandhiera-eyaml (HierarchicalDatalookup)
Gerrit (Codereview system)
Git (what else?)
GitFlow, adaptedversionforGerrit
R10K (Environment deployment tool)
16 / 44
Domain#1:
Server Roles
17 / 44
Alayer ofabstraction
18 / 44
How to do it?
Createroles module
root@puppet# puppet module generate gerapeldoorn-role
Createabase-roleto cover generic settings
# modules/role/manifests/base.pp:
class role::base {
include users
include ssh
include motd
...
19 / 44
How to do it? -Cont'd-
Put all requiredresources intheclasses
# modules/role/manifests/app.pp:
class role::app {
include apache
include tomcat
apache::virtualhost { 'default':
...
Includeroleinnodedefinition
# site.pp:
node 'app01.autiplan.com' {
include role::base
include role::app
}
20 / 44
Domain#2:
All things Data
21 / 44
Hiera
Hierarchical data lookup tool
22 / 44
ConfiguredHierarchy:
#/etc/puppet/hiera.yaml:
:hierarchy:
- "%{::clientcert}"
- "%{::environment}"
- common
Node app01.autiplan.com:
environment: testing
Hieradata
# hiera/app01.autiplan.com.yaml
---
examplekey: value for 
app01.autiplan.com
# hiera/testing.yaml
---
examplekey: value for nodes in 
testing environment
# hiera/common.yaml
---
examplekey: value for all nodes
It's all about Hierarchy
What will bein$test?
$test = hiera('examplekey')
23 / 44
Types of Hieradata
Regular values
# hiera/app01.autiplan.com.yaml
---
examplekey: value
24 / 44
Types of Hieradata
Arrays
# hiera/app01.autiplan.com.yaml
---
array: [ item1, item2, item3 ]
otherarray:
- item1
- item2
- item3
Note: Never use tabs in Hiera files!
25 / 44
Types of Hieradata
Hashes
# hiera/app01.autiplan.com.yaml
---
hash:
key1: value
key2: value
26 / 44
Types of Hieradata
Combinations
# hiera/app01.autiplan.com.yaml
---
hash:
key1: value
key2: value
key3:
- arrayvalue1
- arrayvalue2
key4:
subhashkey1: value
subhashkey2: value
27 / 44
Hiera-relatedfunctions
...and what to use them for
28 / 44
Whatdoes itdo?
Retrieves the first-found value in the
hierarchy. (top-down)
Whatto use itfor?
Basic variable-lookup.
Very easy to create exceptions!
Howto use it?
$smarthost = hiera('smarthost')
ExampleHieradata
# hiera/mail.autiplan.com.yaml
---
smarthost: smtp.myprovider.nl
# hiera/testing.yaml
---
smarthost: testsmtp.autiplan.com
# hiera/common.yaml
---
smarthost: mail.autiplan.com
hiera('key' [,default_value])
29 / 44
Whatdoes itdo?
Retrieves an array or hash value
in the hierarchy, concatinates all
found results
Whatto use itfor?
Combining data from all
hierarchy levels.
Howto use it?
$users = hiera_array('users')
ExampleHieradata
# hiera/app01.autiplan.com.yaml
---
users: [ 'user1', 'user2' ]
# hiera/testing.yaml
---
users: [ 'testuser' ]
# hiera/common.yaml
---
users: [ 'user3', 'user4' ]
hiera_array('key' [,default_value]) (andhiera_hash)
30 / 44
Whatdoes itdo?
Includes all classes listed in the
array that is loaded from Hiera.
Takes elements from ALL
hierarchy levels.
Whatto use itfor?
Lightweight ENC.
Put all classes / roles in Hiera.
Howto use it?
node default {
hiera_include('roles')
}
ExampleHieradata
# hiera/web01.autiplan.com.yaml
---
roles:
- role::web
# hiera/common.yaml
---
roles:
- role::base
hiera_include('classes')
31 / 44
Whatdoes itdo?
Generates resources from a
HASH.
Whatto use itfor?
Generate any resource based on
data from Hiera.
Can also be used with
hiera_hash to create resources
from all levels!
Howto use it?
create_resources ('apache::vhost', hiera('vhosts', {}))
ExampleHieradata
# hiera/web01.autiplan.com.yaml
---
vhosts:
autiplan.com:
alias: www.autiplan.com
autiplan.dk:
alias: www.autiplan.dk
docroot: /var/www/html/autiplan.dk
autiplan.nl:
alias: www.autiplan.nl
cdn.autiplan.com:
port: 81
docroot: /var/www/html/cdn
create_resources('type',HASH[,default_values])
32 / 44
Databindings
Auto-loading of Hiera data for parameterized classes.
33 / 44
Whatdoes itdo?
Automatically loads class
parameters from Hiera.
Whatto use itfor?
Specify all class parameters in
Hiera.
Use all hierarchical benefits for
class parameters.
Simplify the use of
parameterized classes.
Howto use it?
include mysql::server
ExampleHieradata
# hiera/web01.autiplan.com.yaml
---
mysql::server::root_password: m0ars3cr3t
# hiera/common.yaml
---
mysql::server::root_password: t0ps3cr3t
mysql::server::package_name: mysql-server
mysql::server::restart: true
Data bindings
34 / 44
Putting it all together
Anything node-specific should be in Hiera!
35 / 44
APuppet Run:What calls what?
36 / 44
Domain#3:
Deployment & Workflow
37 / 44
Environments
Keeping the environmentalists happy
38 / 44
Environments
What is anenvironment?
Seperate modulepaths/site.pp.
Common environments: development, testing, production.
Nodes request a specific environment.
Why?
Essential to prevent mistakes.
NEVER edit code in production!
The workflow helps us to 'promote' our code to production.
39 / 44
Demo!
40 / 44
R10koverview
41 / 44
Final remarks
Keeppublic modules as-is,wherever possible
Create wrapper classes in company-module.
Create fork if needed, submit pull request for fixes.
Add forked module (gitrepo) to Puppetfile.
Thinkahead
Always try to anticipate future applications.
If it feels overly complicated, yer doin it wrong.
Refactor!
42 / 44
Questions?
43 / 44
Freelance PuppetConsultant
TrainerforPuppetLabs Benelux
Thank you!
A howto of setting up this environment (and the workflow!) is available on my
blog: http://puppetspecialist.nl/mpi
44 / 44

More Related Content

PDF
Puppet Camp Portland 2015: Introduction to Hiera (Beginner)
PDF
Using hiera with puppet
PDF
Puppet for Sys Admins
PDF
Getting Hiera and Hiera
PDF
Delegated Configuration with Multiple Hiera Databases - PuppetConf 2014
PPTX
Spl to the Rescue - Zendcon 09
PDF
Doing the Refactor Dance - Making Your Puppet Modules More Modular - PuppetCo...
PDF
20130407 load puppevtv3-and_hiera
Puppet Camp Portland 2015: Introduction to Hiera (Beginner)
Using hiera with puppet
Puppet for Sys Admins
Getting Hiera and Hiera
Delegated Configuration with Multiple Hiera Databases - PuppetConf 2014
Spl to the Rescue - Zendcon 09
Doing the Refactor Dance - Making Your Puppet Modules More Modular - PuppetCo...
20130407 load puppevtv3-and_hiera

What's hot (20)

PDF
Refactor Dance - Puppet Labs 'Best Practices'
PDF
Writing and using php streams and sockets tek11
PDF
SPL to the Rescue - Tek 09
PDF
Puppet Camp Paris 2016 Data in Modules
PDF
Spl in the wild
PPTX
Php on the desktop and php gtk2
PDF
Can you upgrade to Puppet 4.x?
PDF
Power of Puppet 4
PDF
Anatomy of a reusable module
PDF
Php go vrooom!
PDF
Puppet @ Seat
PDF
Doing It Wrong with Puppet -
PDF
Puppet modules for Fun and Profit
PPTX
Php on the Web and Desktop
PDF
PECL Picks - Extensions to make your life better
PPTX
Puppet camp chicago-automated_testing2
PDF
Puppet at Bazaarvoice
PDF
Puppet Camp DC 2015: Stop Writing Puppet Modules: A Guide to Best Practices i...
PDF
Apache Hacks
PPTX
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)
Refactor Dance - Puppet Labs 'Best Practices'
Writing and using php streams and sockets tek11
SPL to the Rescue - Tek 09
Puppet Camp Paris 2016 Data in Modules
Spl in the wild
Php on the desktop and php gtk2
Can you upgrade to Puppet 4.x?
Power of Puppet 4
Anatomy of a reusable module
Php go vrooom!
Puppet @ Seat
Doing It Wrong with Puppet -
Puppet modules for Fun and Profit
Php on the Web and Desktop
PECL Picks - Extensions to make your life better
Puppet camp chicago-automated_testing2
Puppet at Bazaarvoice
Puppet Camp DC 2015: Stop Writing Puppet Modules: A Guide to Best Practices i...
Apache Hacks
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)
Ad

Similar to Puppet Camp Berlin 2014: Manageable puppet infrastructure (20)

PDF
Manageable Puppet Infrastructure - PuppetConf 2014
PDF
Puppet Camp Amsterdam 2015: How To Leverage The Power of the Puppet Forge
PDF
CCF #1: Taking the reins of your data with Hiera 5
PDF
PuppetConf 2017: Hiera 5: The Full Data Enchilada- Hendrik Lindberg, Puppet
PDF
CfgMgmtCamp 2023 - Puppet is YAML.pdf
PPTX
Puppet Camp DC: Puppet for Everybody
PDF
Solving real world data problems with Jerakia
PPTX
Hiera in-motion
PPTX
Puppet for Everybody: Federated and Hierarchical Puppet Enterprise
PDF
Modules of the twenties
PDF
Going beyond Code: Driving automation with data via Hiera
PDF
Going beyond Code: Driving automation with data via Hiera
PPTX
Rpug - Puppet 4 Module Data
PDF
From SaltStack to Puppet and beyond...
PPTX
Puppet for Everybody! - Federated and Hierarchical Puppet Enterprise - Puppet...
PDF
Intro to-puppet
PDF
Workflow story: Theory versus Practice in large enterprises by Marcin Piebiak
PDF
Workflow story: Theory versus practice in Large Enterprises
PDF
Improving Operations Efficiency with Puppet
PDF
Love / Hate Puppet (Puppet Gotchas)
Manageable Puppet Infrastructure - PuppetConf 2014
Puppet Camp Amsterdam 2015: How To Leverage The Power of the Puppet Forge
CCF #1: Taking the reins of your data with Hiera 5
PuppetConf 2017: Hiera 5: The Full Data Enchilada- Hendrik Lindberg, Puppet
CfgMgmtCamp 2023 - Puppet is YAML.pdf
Puppet Camp DC: Puppet for Everybody
Solving real world data problems with Jerakia
Hiera in-motion
Puppet for Everybody: Federated and Hierarchical Puppet Enterprise
Modules of the twenties
Going beyond Code: Driving automation with data via Hiera
Going beyond Code: Driving automation with data via Hiera
Rpug - Puppet 4 Module Data
From SaltStack to Puppet and beyond...
Puppet for Everybody! - Federated and Hierarchical Puppet Enterprise - Puppet...
Intro to-puppet
Workflow story: Theory versus Practice in large enterprises by Marcin Piebiak
Workflow story: Theory versus practice in Large Enterprises
Improving Operations Efficiency with Puppet
Love / Hate Puppet (Puppet Gotchas)
Ad

More from Puppet (20)

PPTX
Puppet Community Day: Planning the Future Together
PPTX
The Evolution of Puppet: Key Changes and Modernization Tips
PPTX
Can You Help Me Upgrade to Puppet 8? Tips, Tools & Best Practices for Your Up...
PPTX
Bolt Dynamic Inventory: Making Puppet Easier
PPTX
Customizing Reporting with the Puppet Report Processor
PPTX
Puppet at ConfigMgmtCamp 2025 Sponsor Deck
PPTX
The State of Puppet in 2025: A Presentation from Developer Relations Lead Dav...
PPTX
Let Red be Red and Green be Green: The Automated Workflow Restarter in GitHub...
PDF
Puppet camp2021 testing modules and controlrepo
PPTX
Puppetcamp r10kyaml
PDF
2021 04-15 operational verification (with notes)
PPTX
Puppet camp vscode
PDF
Applying Roles and Profiles method to compliance code
PPTX
KGI compliance as-code approach
PDF
Enforce compliance policy with model-driven automation
PDF
Keynote: Puppet camp compliance
PPTX
Automating it management with Puppet + ServiceNow
PPTX
Puppet: The best way to harden Windows
PPTX
Simplified Patch Management with Puppet - Oct. 2020
PPTX
Accelerating azure adoption with puppet
Puppet Community Day: Planning the Future Together
The Evolution of Puppet: Key Changes and Modernization Tips
Can You Help Me Upgrade to Puppet 8? Tips, Tools & Best Practices for Your Up...
Bolt Dynamic Inventory: Making Puppet Easier
Customizing Reporting with the Puppet Report Processor
Puppet at ConfigMgmtCamp 2025 Sponsor Deck
The State of Puppet in 2025: A Presentation from Developer Relations Lead Dav...
Let Red be Red and Green be Green: The Automated Workflow Restarter in GitHub...
Puppet camp2021 testing modules and controlrepo
Puppetcamp r10kyaml
2021 04-15 operational verification (with notes)
Puppet camp vscode
Applying Roles and Profiles method to compliance code
KGI compliance as-code approach
Enforce compliance policy with model-driven automation
Keynote: Puppet camp compliance
Automating it management with Puppet + ServiceNow
Puppet: The best way to harden Windows
Simplified Patch Management with Puppet - Oct. 2020
Accelerating azure adoption with puppet

Recently uploaded (20)

PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
AI in Product Development-omnex systems
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Understanding Forklifts - TECH EHS Solution
PPTX
Introduction to Artificial Intelligence
PDF
System and Network Administraation Chapter 3
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
top salesforce developer skills in 2025.pdf
PPTX
ai tools demonstartion for schools and inter college
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
medical staffing services at VALiNTRY
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PPTX
L1 - Introduction to python Backend.pptx
PDF
How Creative Agencies Leverage Project Management Software.pdf
Wondershare Filmora 15 Crack With Activation Key [2025
Design an Analysis of Algorithms I-SECS-1021-03
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Reimagine Home Health with the Power of Agentic AI​
Navsoft: AI-Powered Business Solutions & Custom Software Development
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
AI in Product Development-omnex systems
Softaken Excel to vCard Converter Software.pdf
Understanding Forklifts - TECH EHS Solution
Introduction to Artificial Intelligence
System and Network Administraation Chapter 3
How to Choose the Right IT Partner for Your Business in Malaysia
top salesforce developer skills in 2025.pdf
ai tools demonstartion for schools and inter college
Design an Analysis of Algorithms II-SECS-1021-03
medical staffing services at VALiNTRY
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
L1 - Introduction to python Backend.pptx
How Creative Agencies Leverage Project Management Software.pdf

Puppet Camp Berlin 2014: Manageable puppet infrastructure