SlideShare una empresa de Scribd logo
1 de 43
Descargar para leer sin conexión
Copyright example42 GmbH - 2016
Puppet 4 - Data in Modules
PuppetCamp Paris 2016
Martin Alfke - ma@example42.com
Image: Tatlin - tatlin.net
Copyright example42 GmbH - 2016
Copyright example42 GmbH - 2016
Martin Alfke
!
Berlin/Germany
!
CEO example42 GmbH
Freelance Puppet Expert
Network
!
Puppet since 2007
!
Puppet Trainer, Consultant
!
Co-Author of “Puppet 4
Essentials”
Copyright example42 GmbH - 2016
Puppet 4
Data in Modules
• Separation of Code and Data
• Data in Modules
• Lookup Priority
• Data in Component Modules
• Data in Environments
Copyright example42 GmbH - 2016
Separation of
Code and Data
Image: Tatlin - tatlin.net
Copyright example42 GmbH - 2016
Separation of
Code and Data
• data in code
class my_ntp {!
!if $::environment == ‘dev’ {!
$ntp_server = [‘pool.ntp.org’]!
} else {!
if $::facts[‘fqdn’] == ‘ntp1.example42.com’
{!
# switch back to ntp1 when issue is solved!
$ntp_server = [‘ntp2.example42.com’]!
} else {!
$ntp_server = [‘127.0.0.1’]!
}!
}!
Copyright example42 GmbH - 2016
Separation of
Code and Data
• explicit lookup
• hiera(‘key’[, ‘default’][, ‘override hierarchy’])
Copyright example42 GmbH - 2016
Separation of
Code and Data
• implicit lookup
class my_ntp (!
!Array $ntp_server,!
) {!
!# …!
}!
!
contain my_ntp!
!
# hiera data!
my_ntp::ntp_server:!
- ‘pool.ntp.org’!
Copyright example42 GmbH - 2016
Separation of
Code and Data
• hiera.yaml
# version 1!
:backends:!
- yaml!
:yaml:!
:datadir: “/etc/puppetlabs/code/
environments/%{environment}/hieradata”!
:hierarchy:!
- “nodes/%{::trusted.certname}”!
- “os/%{::facts[‘os’][‘osfamily’]}”!
- common!
Copyright example42 GmbH - 2016
Separation of
Code and Data
• hieradata
os/Debian.yaml
apache::pkgname:!
- ‘apache2’!
- ‘apache2-ssl’!
!
os/RedHat.yaml
apache::pkgname:!
- ‘httpd’!
!
common.yaml
apache::purge_configs: true!
Copyright example42 GmbH - 2016
Separation of
Code and Data
• hieradata
os/FreeBSD.yaml
apache::pkgname:!
- ‘apache’!
Copyright example42 GmbH - 2016
Separation of
Code and Data
• puppet code
# apache/manifests/params.pp
class apache::params {!
case $::operatingsystem {!
‘Debian’: { # … }!
‘RedHat’: { # … }!
default: {!
fail(‘OS not supported’)!
}!
}!
}!
Copyright example42 GmbH - 2016
Data in Modules
Image: Tatlin - tatlin.net
Copyright example42 GmbH - 2016
Lookup Priority
Image: Tatlin - tatlin.net
Copyright example42 GmbH - 2016
Lookup Priority
• Hiera -> Global Overrides
!
!
!
Copyright example42 GmbH - 2016
Lookup Priority
• Hiera -> Global Overrides
!
• Environment Data -> Core Puppet Lookup
!
Copyright example42 GmbH - 2016
Lookup Priority
• Hiera -> Global Overrides
!
• Environment Data -> Core Puppet Lookup
!
• Module Data -> Defaults
Copyright example42 GmbH - 2016
Lookup Functions
• Explicit lookup: lookup(‘key’)!
!
• CLI lookup: puppet lookup ‘key’
!
• Automatic lookup: ‘<namespace>::<key>’
Copyright example42 GmbH - 2016
Lookup Functions
• lookup(‘key’, <Type>, <merge_behavior>, <default>)!
• e.g. lookup(‘ntp_servers’, Array)
• Merge behavior:
• first!
• unique (array merge)!
• hash!
• deep!
Copyright example42 GmbH - 2016
Data Provider
Configuration
• Global Environment Provider: puppet.conf
• environment_data_provider = <data provider>!
!
!
!
Copyright example42 GmbH - 2016
Data Provider
Configuration
• Global Environment Provider: puppet.conf
• environment_data_provider = <data provider>!
• Environment Provider: environment.conf
• environment_data_provider = <data provider>!
!
Copyright example42 GmbH - 2016
Data Provider
Configuration
• Global Environment Provider: puppet.conf
• environment_data_provider = <data provider>!
• Environment Provider: environment.conf
• environment_data_provider = <data provider>!
• Module Provider: metadata.json
• “data_provider”: “<data provider>”
Copyright example42 GmbH - 2016
Data Provider
• none -> standard hiera lookup
!
• hiera -> hiera lookup (hiera v4)
!
• function -> data function lookup
Copyright example42 GmbH - 2016
Data Provider
Hiera
• replace hiera, hiera_array, hiera_hash with ‘lookup’
• needs hiera.yaml v4 configuration file
• set data_provider to ‘hiera’ in puppet.conf,
environment.conf or metadata.json
• modify global hiera.yaml to use datadir outside
environment
Copyright example42 GmbH - 2016
Data Provider
Hiera
# /etc/puppetlabs/code/environments/production/hiera.yaml
# /etc/puppetlabs/code/environments/production/modules/<module>/
hiera.yaml
#
- - -!
version: 4!
datadir: hieradata!
hierarchy:!
- name: “Nodes”!
backend: yaml!
path: “nodes/%{trusted.certname}”!
- name: “OS”!
backend: json!
path: “os/%{facts.os.family}”!
- name: “common”!
backend: yaml
Copyright example42 GmbH - 2016
Data Provider
Function
• write data function
• Puppet 4 Function
• <module>/functions/<module>/data.pp
• <env>/functions/<env>/data.pp
• set data_provider to function in puppet.conf,
environment.conf or metadata.json
Copyright example42 GmbH - 2016
Data Provider
Function - Puppet
# ntp/functions/ntp/data.pp
function ntp::data() {!
$params = {!
‘ntp::ntpservers’ => [‘pool.ntp.org’],!
}!
$os_params = case $facts[‘os’][‘family’] {!
‘Debian’: {!
{ ‘ntp::ntpackage’ => ‘ntpd’, }!
},!
default: {!
{}!
}!
}!
$params + $os_params!
}
Copyright example42 GmbH - 2016
Data Provider
Function
• write data function
• Ruby Function (Puppet 4 function API)
• <module>/lib/puppet/functions/<module>/
data.rb
• <env>/lib/puppet/functions/<env>/data.rb
• set data_provider to function in puppet.conf,
environment.conf or metadata.json
Copyright example42 GmbH - 2016
Data Provider
Function - Ruby
# ntp/lib/puppet/functions/ntp/data.rb
Puppet::Functions.create_function(:’ntp::data’) do!
def base_data()!
{ ‘ntp::ntpservers’ => [‘pool.ntp.org’], }!
end!
def os_data()!
case Facter.value(:os)[‘family’]!
when ‘Debian’!
{ ‘ntp::pkgname’ => ‘ntpd’, }!
else!
{}!
end!
def data()!
self.base_data.merge!(self.os_data)!
end!
end
Copyright example42 GmbH - 2016
Data in Component Modules
Image: Tatlin - tatlin.net
Copyright example42 GmbH - 2016
Data in Component Modules
• add data provider to metadata.json
• provide OS defaults
• remove params.pp / remove inheritance
• allow users to overwrite any data
Copyright example42 GmbH - 2016
Data Provider
Function - Ruby
# my_ntp/manifests/init.pp
class my_ntp (!
$server = $my_ntp::params::server,!
$pkgname = $my_ntp::params::pkgname,!
$secure = $my_ntp::params::secure,!
) inherits my_ntp::params {!
# ...!
}!
Copyright example42 GmbH - 2016
Data in Environments
Image: Tatlin - tatlin.net
Copyright example42 GmbH - 2016
Data in Environments
• old hiera replacement
• add hiera.yaml to environment base path
• overwrite data from modules, roles & profiles
Copyright example42 GmbH - 2016
Summary
Image: Tatlin - tatlin.net
Copyright example42 GmbH - 2016
Summary
# /etc/puppetlabs/code/
! ! hiera.yaml!
! ! hieradata/!
! ! environments/production/
! ! ! ! ! ! environment.conf!
! ! ! ! ! ! hiera.yaml!
! ! ! ! ! ! hieradata/!
modules/my_module/
! ! ! ! ! ! ! ! ! ! metadata.json!
! ! ! ! ! ! ! ! ! ! hiera.yaml!
! ! ! ! ! ! ! ! ! ! hieradata/
Copyright example42 GmbH - 2016
Summary
# /etc/puppetlabs/code/
! ! hiera.yaml!
! ! hieradata/!
! ! environments/production/
! ! ! ! ! environment.conf!
! ! ! ! ! lib/functions/data.pp!
! ! ! ! ! lib/puppet/functions/ !
! ! ! ! ! ! ! ! production/data.rb!
modules/my_module/
! ! ! ! ! ! !! ! metadata.json!
! ! ! ! ! ! ! ! lib/functions/data.pp!
! ! ! ! ! ! ! ! lib/puppet/functions/ !
! ! ! ! ! ! ! ! ! ! ! my_module/data.rb
Copyright example42 GmbH - 2016
Summary - Pro
• Per hierarchy Hiera Data backend possible
• Data Function lookups without need for hiera
backend (e.g. Cloud Management API data)
• No more inheritance required
Copyright example42 GmbH - 2016
Summary - Con
• No single Source of Authority?
• Debugging can be complex when iterating over
many data providers and hierarchies
Copyright example42 GmbH - 2016
Module Developers
• switch to data in modules
• give users the possibility to provide own data
• allow users to overwrite any data
• allow users to know their data for missing OS
support
Copyright example42 GmbH - 2016
Module Users
• switch to hieradata in modules
then
• switch to data in environments
• keep data simple and readable
• don’t overcomplicate !
Copyright example42 GmbH - 2016
Module Users
• hieradata
common.yaml
my_ntp: ‘pool.ntp.org’!
apache::default_mods: false!
apache::purge_configs: true!
mysql::remove_default_accounts: true!
mysql::root_password: ‘puppet’!
oradb::database::version: ’12.1’!
oradb::shout: ‘MISSING DATA’
Copyright example42 GmbH - 2016
References
• http://docs.puppetlabs.com/puppet/4.3/reference/
lookup_quick.html
• http://docs.puppetlabs.com/puppet/4.3/reference/
lookup_quick_module.html
• http://puppet-on-the-edge.blogspot.de/2015/01/
puppet-40-data-in-modules-and.html
Copyright example42 GmbH - 2016
Puppet 4 - Data in modules
PuppetCamp Paris 2016
Martin Alfke - ma@example42.com
Image: Tatlin - tatlin.net
Copyright example42 GmbH - 2016

Más contenido relacionado

La actualidad más candente

Puppet modules: An Holistic Approach
Puppet modules: An Holistic ApproachPuppet modules: An Holistic Approach
Puppet modules: An Holistic ApproachAlessandro Franceschi
 
Puppet for Sys Admins
Puppet for Sys AdminsPuppet for Sys Admins
Puppet for Sys AdminsPuppet
 
Creating a mature puppet system
Creating a mature puppet systemCreating a mature puppet system
Creating a mature puppet systemrkhatibi
 
Puppet Continuous Integration with PE and GitLab
Puppet Continuous Integration with PE and GitLabPuppet Continuous Integration with PE and GitLab
Puppet Continuous Integration with PE and GitLabAlessandro Franceschi
 
Auto Deploy Deep Dive – vBrownBag Style
Auto Deploy Deep Dive – vBrownBag StyleAuto Deploy Deep Dive – vBrownBag Style
Auto Deploy Deep Dive – vBrownBag StyleRobert Nelson
 
How to build your own OpenStack distro using Puppet OpenStack
How to build your own OpenStack distro using Puppet OpenStackHow to build your own OpenStack distro using Puppet OpenStack
How to build your own OpenStack distro using Puppet OpenStackOpenStack
 
Essential applications management with Tiny Puppet
Essential applications management with Tiny PuppetEssential applications management with Tiny Puppet
Essential applications management with Tiny PuppetAlessandro Franceschi
 
Puppet Camp Dallas 2014: How Puppet Ops Rolls
Puppet Camp Dallas 2014: How Puppet Ops RollsPuppet Camp Dallas 2014: How Puppet Ops Rolls
Puppet Camp Dallas 2014: How Puppet Ops RollsPuppet
 
Our Puppet Story (Linuxtag 2014)
Our Puppet Story (Linuxtag 2014)Our Puppet Story (Linuxtag 2014)
Our Puppet Story (Linuxtag 2014)DECK36
 
Puppet control-repo 
to the next level
Puppet control-repo 
to the next levelPuppet control-repo 
to the next level
Puppet control-repo 
to the next levelAlessandro Franceschi
 
Writing Custom Puppet Types and Providers to Manage Web-Based Applications
Writing Custom Puppet Types and Providers to Manage Web-Based ApplicationsWriting Custom Puppet Types and Providers to Manage Web-Based Applications
Writing Custom Puppet Types and Providers to Manage Web-Based ApplicationsTim Cinel
 
Puppet modules: A Holistic Approach - Geneva
Puppet modules: A Holistic Approach - GenevaPuppet modules: A Holistic Approach - Geneva
Puppet modules: A Holistic Approach - GenevaAlessandro Franceschi
 
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013Puppet
 
Bootstrapping Puppet and Application Deployment - PuppetConf 2013
Bootstrapping Puppet and Application Deployment - PuppetConf 2013Bootstrapping Puppet and Application Deployment - PuppetConf 2013
Bootstrapping Puppet and Application Deployment - PuppetConf 2013Puppet
 
Puppet for dummies - ZendCon 2011 Edition
Puppet for dummies - ZendCon 2011 EditionPuppet for dummies - ZendCon 2011 Edition
Puppet for dummies - ZendCon 2011 EditionJoshua Thijssen
 

La actualidad más candente (20)

Puppet modules: An Holistic Approach
Puppet modules: An Holistic ApproachPuppet modules: An Holistic Approach
Puppet modules: An Holistic Approach
 
Puppet for Sys Admins
Puppet for Sys AdminsPuppet for Sys Admins
Puppet for Sys Admins
 
Creating a mature puppet system
Creating a mature puppet systemCreating a mature puppet system
Creating a mature puppet system
 
Puppet Continuous Integration with PE and GitLab
Puppet Continuous Integration with PE and GitLabPuppet Continuous Integration with PE and GitLab
Puppet Continuous Integration with PE and GitLab
 
Auto Deploy Deep Dive – vBrownBag Style
Auto Deploy Deep Dive – vBrownBag StyleAuto Deploy Deep Dive – vBrownBag Style
Auto Deploy Deep Dive – vBrownBag Style
 
How to build your own OpenStack distro using Puppet OpenStack
How to build your own OpenStack distro using Puppet OpenStackHow to build your own OpenStack distro using Puppet OpenStack
How to build your own OpenStack distro using Puppet OpenStack
 
Essential applications management with Tiny Puppet
Essential applications management with Tiny PuppetEssential applications management with Tiny Puppet
Essential applications management with Tiny Puppet
 
Puppet Camp Dallas 2014: How Puppet Ops Rolls
Puppet Camp Dallas 2014: How Puppet Ops RollsPuppet Camp Dallas 2014: How Puppet Ops Rolls
Puppet Camp Dallas 2014: How Puppet Ops Rolls
 
Our Puppet Story (Linuxtag 2014)
Our Puppet Story (Linuxtag 2014)Our Puppet Story (Linuxtag 2014)
Our Puppet Story (Linuxtag 2014)
 
Tp install anything
Tp install anythingTp install anything
Tp install anything
 
Puppet @ Seat
Puppet @ SeatPuppet @ Seat
Puppet @ Seat
 
Puppet control-repo 
to the next level
Puppet control-repo 
to the next levelPuppet control-repo 
to the next level
Puppet control-repo 
to the next level
 
Puppet evolutions
Puppet evolutionsPuppet evolutions
Puppet evolutions
 
Writing Custom Puppet Types and Providers to Manage Web-Based Applications
Writing Custom Puppet Types and Providers to Manage Web-Based ApplicationsWriting Custom Puppet Types and Providers to Manage Web-Based Applications
Writing Custom Puppet Types and Providers to Manage Web-Based Applications
 
Puppet modules: A Holistic Approach - Geneva
Puppet modules: A Holistic Approach - GenevaPuppet modules: A Holistic Approach - Geneva
Puppet modules: A Holistic Approach - Geneva
 
Troubleshooting Puppet
Troubleshooting PuppetTroubleshooting Puppet
Troubleshooting Puppet
 
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
 
Bootstrapping Puppet and Application Deployment - PuppetConf 2013
Bootstrapping Puppet and Application Deployment - PuppetConf 2013Bootstrapping Puppet and Application Deployment - PuppetConf 2013
Bootstrapping Puppet and Application Deployment - PuppetConf 2013
 
Puppet for dummies - ZendCon 2011 Edition
Puppet for dummies - ZendCon 2011 EditionPuppet for dummies - ZendCon 2011 Edition
Puppet for dummies - ZendCon 2011 Edition
 
Unit Testing Lots of Perl
Unit Testing Lots of PerlUnit Testing Lots of Perl
Unit Testing Lots of Perl
 

Similar a Puppet Camp Paris 2016 Data in Modules

Delegated Configuration with Multiple Hiera Databases - PuppetConf 2014
Delegated Configuration with Multiple Hiera Databases - PuppetConf 2014Delegated Configuration with Multiple Hiera Databases - PuppetConf 2014
Delegated Configuration with Multiple Hiera Databases - PuppetConf 2014Puppet
 
Puppet at Bazaarvoice
Puppet at BazaarvoicePuppet at Bazaarvoice
Puppet at BazaarvoicePuppet
 
Robert Meyer- pypet
Robert Meyer- pypetRobert Meyer- pypet
Robert Meyer- pypetPyData
 
Writing and Sharing Great Modules with the Puppet Forge
Writing and Sharing Great Modules with the Puppet ForgeWriting and Sharing Great Modules with the Puppet Forge
Writing and Sharing Great Modules with the Puppet ForgePuppet
 
Ben ford intro
Ben ford introBen ford intro
Ben ford introPuppet
 
Telemetry doesn't have to be scary; Ben Ford
Telemetry doesn't have to be scary; Ben FordTelemetry doesn't have to be scary; Ben Ford
Telemetry doesn't have to be scary; Ben FordPuppet
 
Puppet atbazaarvoice
Puppet atbazaarvoicePuppet atbazaarvoice
Puppet atbazaarvoiceDave Barcelo
 
Solving real world data problems with Jerakia
Solving real world data problems with JerakiaSolving real world data problems with Jerakia
Solving real world data problems with JerakiaCraig Dunn
 
Experimentation Platform on Hadoop
Experimentation Platform on HadoopExperimentation Platform on Hadoop
Experimentation Platform on HadoopDataWorks Summit
 
eBay Experimentation Platform on Hadoop
eBay Experimentation Platform on HadoopeBay Experimentation Platform on Hadoop
eBay Experimentation Platform on HadoopTony Ng
 
Our Puppet Story (GUUG FFG 2015)
Our Puppet Story (GUUG FFG 2015)Our Puppet Story (GUUG FFG 2015)
Our Puppet Story (GUUG FFG 2015)DECK36
 
Hadoop and the Data Warehouse: Point/Counter Point
Hadoop and the Data Warehouse: Point/Counter PointHadoop and the Data Warehouse: Point/Counter Point
Hadoop and the Data Warehouse: Point/Counter PointInside Analysis
 
BinaryPig - Scalable Malware Analytics in Hadoop
BinaryPig - Scalable Malware Analytics in HadoopBinaryPig - Scalable Malware Analytics in Hadoop
BinaryPig - Scalable Malware Analytics in HadoopJason Trost
 
Hadoop @ Yahoo! - Internet Scale Data Processing
Hadoop @ Yahoo! - Internet Scale Data ProcessingHadoop @ Yahoo! - Internet Scale Data Processing
Hadoop @ Yahoo! - Internet Scale Data ProcessingYahoo Developer Network
 
Scaling Analysis Responsibly
Scaling Analysis ResponsiblyScaling Analysis Responsibly
Scaling Analysis ResponsiblyWork-Bench
 
Strategies for Puppet code upgrade and refactoring
Strategies for Puppet code upgrade and refactoringStrategies for Puppet code upgrade and refactoring
Strategies for Puppet code upgrade and refactoringAlessandro Franceschi
 
Off-Label Data Mesh: A Prescription for Healthier Data
Off-Label Data Mesh: A Prescription for Healthier DataOff-Label Data Mesh: A Prescription for Healthier Data
Off-Label Data Mesh: A Prescription for Healthier DataHostedbyConfluent
 
Scaling up with hadoop and banyan at ITRIX-2015, College of Engineering, Guindy
Scaling up with hadoop and banyan at ITRIX-2015, College of Engineering, GuindyScaling up with hadoop and banyan at ITRIX-2015, College of Engineering, Guindy
Scaling up with hadoop and banyan at ITRIX-2015, College of Engineering, GuindyRohit Kulkarni
 
Open Source Tools for Leveling Up Operations FOSSET 2014
Open Source Tools for Leveling Up Operations FOSSET 2014Open Source Tools for Leveling Up Operations FOSSET 2014
Open Source Tools for Leveling Up Operations FOSSET 2014Mandi Walls
 

Similar a Puppet Camp Paris 2016 Data in Modules (20)

Delegated Configuration with Multiple Hiera Databases - PuppetConf 2014
Delegated Configuration with Multiple Hiera Databases - PuppetConf 2014Delegated Configuration with Multiple Hiera Databases - PuppetConf 2014
Delegated Configuration with Multiple Hiera Databases - PuppetConf 2014
 
Puppet at Bazaarvoice
Puppet at BazaarvoicePuppet at Bazaarvoice
Puppet at Bazaarvoice
 
Robert Meyer- pypet
Robert Meyer- pypetRobert Meyer- pypet
Robert Meyer- pypet
 
Writing and Sharing Great Modules with the Puppet Forge
Writing and Sharing Great Modules with the Puppet ForgeWriting and Sharing Great Modules with the Puppet Forge
Writing and Sharing Great Modules with the Puppet Forge
 
Ben ford intro
Ben ford introBen ford intro
Ben ford intro
 
Telemetry doesn't have to be scary; Ben Ford
Telemetry doesn't have to be scary; Ben FordTelemetry doesn't have to be scary; Ben Ford
Telemetry doesn't have to be scary; Ben Ford
 
Puppet atbazaarvoice
Puppet atbazaarvoicePuppet atbazaarvoice
Puppet atbazaarvoice
 
Solving real world data problems with Jerakia
Solving real world data problems with JerakiaSolving real world data problems with Jerakia
Solving real world data problems with Jerakia
 
Experimentation Platform on Hadoop
Experimentation Platform on HadoopExperimentation Platform on Hadoop
Experimentation Platform on Hadoop
 
eBay Experimentation Platform on Hadoop
eBay Experimentation Platform on HadoopeBay Experimentation Platform on Hadoop
eBay Experimentation Platform on Hadoop
 
Our Puppet Story (GUUG FFG 2015)
Our Puppet Story (GUUG FFG 2015)Our Puppet Story (GUUG FFG 2015)
Our Puppet Story (GUUG FFG 2015)
 
Hadoop and the Data Warehouse: Point/Counter Point
Hadoop and the Data Warehouse: Point/Counter PointHadoop and the Data Warehouse: Point/Counter Point
Hadoop and the Data Warehouse: Point/Counter Point
 
BinaryPig - Scalable Malware Analytics in Hadoop
BinaryPig - Scalable Malware Analytics in HadoopBinaryPig - Scalable Malware Analytics in Hadoop
BinaryPig - Scalable Malware Analytics in Hadoop
 
myHadoop 0.30
myHadoop 0.30myHadoop 0.30
myHadoop 0.30
 
Hadoop @ Yahoo! - Internet Scale Data Processing
Hadoop @ Yahoo! - Internet Scale Data ProcessingHadoop @ Yahoo! - Internet Scale Data Processing
Hadoop @ Yahoo! - Internet Scale Data Processing
 
Scaling Analysis Responsibly
Scaling Analysis ResponsiblyScaling Analysis Responsibly
Scaling Analysis Responsibly
 
Strategies for Puppet code upgrade and refactoring
Strategies for Puppet code upgrade and refactoringStrategies for Puppet code upgrade and refactoring
Strategies for Puppet code upgrade and refactoring
 
Off-Label Data Mesh: A Prescription for Healthier Data
Off-Label Data Mesh: A Prescription for Healthier DataOff-Label Data Mesh: A Prescription for Healthier Data
Off-Label Data Mesh: A Prescription for Healthier Data
 
Scaling up with hadoop and banyan at ITRIX-2015, College of Engineering, Guindy
Scaling up with hadoop and banyan at ITRIX-2015, College of Engineering, GuindyScaling up with hadoop and banyan at ITRIX-2015, College of Engineering, Guindy
Scaling up with hadoop and banyan at ITRIX-2015, College of Engineering, Guindy
 
Open Source Tools for Leveling Up Operations FOSSET 2014
Open Source Tools for Leveling Up Operations FOSSET 2014Open Source Tools for Leveling Up Operations FOSSET 2014
Open Source Tools for Leveling Up Operations FOSSET 2014
 

Más de Martin Alfke

CfgMgmtCamp 2023 - Puppet is YAML.pdf
CfgMgmtCamp 2023 - Puppet is YAML.pdfCfgMgmtCamp 2023 - Puppet is YAML.pdf
CfgMgmtCamp 2023 - Puppet is YAML.pdfMartin Alfke
 
HashiTalksDACH-Terraform-Managing training instances in the Cloud
HashiTalksDACH-Terraform-Managing training instances in the CloudHashiTalksDACH-Terraform-Managing training instances in the Cloud
HashiTalksDACH-Terraform-Managing training instances in the CloudMartin Alfke
 
PuppetCamp2021-Testing Modules and ControlRepo.pdf
PuppetCamp2021-Testing Modules and ControlRepo.pdfPuppetCamp2021-Testing Modules and ControlRepo.pdf
PuppetCamp2021-Testing Modules and ControlRepo.pdfMartin Alfke
 
Puppet Camp Germany 2020 - Puppet Control Repo and GIT
Puppet Camp Germany 2020 - Puppet Control Repo and GITPuppet Camp Germany 2020 - Puppet Control Repo and GIT
Puppet Camp Germany 2020 - Puppet Control Repo and GITMartin Alfke
 
DevOps - How to get technical buy in
DevOps - How to get technical buy inDevOps - How to get technical buy in
DevOps - How to get technical buy inMartin Alfke
 
ADDO 2019 DevOps in a containerized world
ADDO 2019 DevOps in a containerized worldADDO 2019 DevOps in a containerized world
ADDO 2019 DevOps in a containerized worldMartin Alfke
 
OpenRheinRuhr 2018 - Ops hates containers! Why?
OpenRheinRuhr 2018 - Ops hates containers! Why?OpenRheinRuhr 2018 - Ops hates containers! Why?
OpenRheinRuhr 2018 - Ops hates containers! Why?Martin Alfke
 
PuppetConf 2016 Moving from Exec to Types and Provides
PuppetConf 2016 Moving from Exec to Types and ProvidesPuppetConf 2016 Moving from Exec to Types and Provides
PuppetConf 2016 Moving from Exec to Types and ProvidesMartin Alfke
 
Upgrading Puppet CommitterConf Essen 2014
Upgrading Puppet CommitterConf Essen 2014Upgrading Puppet CommitterConf Essen 2014
Upgrading Puppet CommitterConf Essen 2014Martin Alfke
 
GUUG Hamburg OpenNebula
GUUG Hamburg OpenNebulaGUUG Hamburg OpenNebula
GUUG Hamburg OpenNebulaMartin Alfke
 
Puppet camp london-modulerewritingsmartway
Puppet camp london-modulerewritingsmartwayPuppet camp london-modulerewritingsmartway
Puppet camp london-modulerewritingsmartwayMartin Alfke
 
Puppet future parser
Puppet future parserPuppet future parser
Puppet future parserMartin Alfke
 
developing sysadmin, sysadmining developersGuug devops puppet
developing sysadmin, sysadmining developersGuug devops puppetdeveloping sysadmin, sysadmining developersGuug devops puppet
developing sysadmin, sysadmining developersGuug devops puppetMartin Alfke
 
Gluster fs buero20_presentation
Gluster fs buero20_presentationGluster fs buero20_presentation
Gluster fs buero20_presentationMartin Alfke
 
Puppet buero20 presentation
Puppet buero20 presentationPuppet buero20 presentation
Puppet buero20 presentationMartin Alfke
 

Más de Martin Alfke (17)

CfgMgmtCamp 2023 - Puppet is YAML.pdf
CfgMgmtCamp 2023 - Puppet is YAML.pdfCfgMgmtCamp 2023 - Puppet is YAML.pdf
CfgMgmtCamp 2023 - Puppet is YAML.pdf
 
HashiTalksDACH-Terraform-Managing training instances in the Cloud
HashiTalksDACH-Terraform-Managing training instances in the CloudHashiTalksDACH-Terraform-Managing training instances in the Cloud
HashiTalksDACH-Terraform-Managing training instances in the Cloud
 
PuppetCamp2021-Testing Modules and ControlRepo.pdf
PuppetCamp2021-Testing Modules and ControlRepo.pdfPuppetCamp2021-Testing Modules and ControlRepo.pdf
PuppetCamp2021-Testing Modules and ControlRepo.pdf
 
Puppet Camp Germany 2020 - Puppet Control Repo and GIT
Puppet Camp Germany 2020 - Puppet Control Repo and GITPuppet Camp Germany 2020 - Puppet Control Repo and GIT
Puppet Camp Germany 2020 - Puppet Control Repo and GIT
 
DevOps - How to get technical buy in
DevOps - How to get technical buy inDevOps - How to get technical buy in
DevOps - How to get technical buy in
 
ADDO 2019 DevOps in a containerized world
ADDO 2019 DevOps in a containerized worldADDO 2019 DevOps in a containerized world
ADDO 2019 DevOps in a containerized world
 
OpenRheinRuhr 2018 - Ops hates containers! Why?
OpenRheinRuhr 2018 - Ops hates containers! Why?OpenRheinRuhr 2018 - Ops hates containers! Why?
OpenRheinRuhr 2018 - Ops hates containers! Why?
 
PuppetConf 2016 Moving from Exec to Types and Provides
PuppetConf 2016 Moving from Exec to Types and ProvidesPuppetConf 2016 Moving from Exec to Types and Provides
PuppetConf 2016 Moving from Exec to Types and Provides
 
Power of Puppet 4
Power of Puppet 4Power of Puppet 4
Power of Puppet 4
 
Upgrading Puppet CommitterConf Essen 2014
Upgrading Puppet CommitterConf Essen 2014Upgrading Puppet CommitterConf Essen 2014
Upgrading Puppet CommitterConf Essen 2014
 
GUUG Hamburg OpenNebula
GUUG Hamburg OpenNebulaGUUG Hamburg OpenNebula
GUUG Hamburg OpenNebula
 
Puppet camp london-modulerewritingsmartway
Puppet camp london-modulerewritingsmartwayPuppet camp london-modulerewritingsmartway
Puppet camp london-modulerewritingsmartway
 
One
OneOne
One
 
Puppet future parser
Puppet future parserPuppet future parser
Puppet future parser
 
developing sysadmin, sysadmining developersGuug devops puppet
developing sysadmin, sysadmining developersGuug devops puppetdeveloping sysadmin, sysadmining developersGuug devops puppet
developing sysadmin, sysadmining developersGuug devops puppet
 
Gluster fs buero20_presentation
Gluster fs buero20_presentationGluster fs buero20_presentation
Gluster fs buero20_presentation
 
Puppet buero20 presentation
Puppet buero20 presentationPuppet buero20 presentation
Puppet buero20 presentation
 

Último

Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableSeo
 
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...singhpriety023
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)Damian Radcliffe
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)Delhi Call girls
 
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersDamian Radcliffe
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.soniya singh
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Call Girls in Nagpur High Profile
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxellan12
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Servicesexy call girls service in goa
 
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceDelhi Call girls
 
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call GirlVIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girladitipandeya
 
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024APNIC
 
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...Escorts Call Girls
 
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663Call Girls Mumbai
 

Último (20)

Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
 
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
 
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
 
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
 
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
 
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
@9999965857 🫦 Sexy Desi Call Girls Laxmi Nagar 💓 High Profile Escorts Delhi 🫶
@9999965857 🫦 Sexy Desi Call Girls Laxmi Nagar 💓 High Profile Escorts Delhi 🫶@9999965857 🫦 Sexy Desi Call Girls Laxmi Nagar 💓 High Profile Escorts Delhi 🫶
@9999965857 🫦 Sexy Desi Call Girls Laxmi Nagar 💓 High Profile Escorts Delhi 🫶
 
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
 
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call GirlVIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
 
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
 
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
 
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
 

Puppet Camp Paris 2016 Data in Modules

  • 1. Copyright example42 GmbH - 2016 Puppet 4 - Data in Modules PuppetCamp Paris 2016 Martin Alfke - ma@example42.com Image: Tatlin - tatlin.net Copyright example42 GmbH - 2016
  • 2. Copyright example42 GmbH - 2016 Martin Alfke ! Berlin/Germany ! CEO example42 GmbH Freelance Puppet Expert Network ! Puppet since 2007 ! Puppet Trainer, Consultant ! Co-Author of “Puppet 4 Essentials”
  • 3. Copyright example42 GmbH - 2016 Puppet 4 Data in Modules • Separation of Code and Data • Data in Modules • Lookup Priority • Data in Component Modules • Data in Environments
  • 4. Copyright example42 GmbH - 2016 Separation of Code and Data Image: Tatlin - tatlin.net
  • 5. Copyright example42 GmbH - 2016 Separation of Code and Data • data in code class my_ntp {! !if $::environment == ‘dev’ {! $ntp_server = [‘pool.ntp.org’]! } else {! if $::facts[‘fqdn’] == ‘ntp1.example42.com’ {! # switch back to ntp1 when issue is solved! $ntp_server = [‘ntp2.example42.com’]! } else {! $ntp_server = [‘127.0.0.1’]! }! }!
  • 6. Copyright example42 GmbH - 2016 Separation of Code and Data • explicit lookup • hiera(‘key’[, ‘default’][, ‘override hierarchy’])
  • 7. Copyright example42 GmbH - 2016 Separation of Code and Data • implicit lookup class my_ntp (! !Array $ntp_server,! ) {! !# …! }! ! contain my_ntp! ! # hiera data! my_ntp::ntp_server:! - ‘pool.ntp.org’!
  • 8. Copyright example42 GmbH - 2016 Separation of Code and Data • hiera.yaml # version 1! :backends:! - yaml! :yaml:! :datadir: “/etc/puppetlabs/code/ environments/%{environment}/hieradata”! :hierarchy:! - “nodes/%{::trusted.certname}”! - “os/%{::facts[‘os’][‘osfamily’]}”! - common!
  • 9. Copyright example42 GmbH - 2016 Separation of Code and Data • hieradata os/Debian.yaml apache::pkgname:! - ‘apache2’! - ‘apache2-ssl’! ! os/RedHat.yaml apache::pkgname:! - ‘httpd’! ! common.yaml apache::purge_configs: true!
  • 10. Copyright example42 GmbH - 2016 Separation of Code and Data • hieradata os/FreeBSD.yaml apache::pkgname:! - ‘apache’!
  • 11. Copyright example42 GmbH - 2016 Separation of Code and Data • puppet code # apache/manifests/params.pp class apache::params {! case $::operatingsystem {! ‘Debian’: { # … }! ‘RedHat’: { # … }! default: {! fail(‘OS not supported’)! }! }! }!
  • 12. Copyright example42 GmbH - 2016 Data in Modules Image: Tatlin - tatlin.net
  • 13. Copyright example42 GmbH - 2016 Lookup Priority Image: Tatlin - tatlin.net
  • 14. Copyright example42 GmbH - 2016 Lookup Priority • Hiera -> Global Overrides ! ! !
  • 15. Copyright example42 GmbH - 2016 Lookup Priority • Hiera -> Global Overrides ! • Environment Data -> Core Puppet Lookup !
  • 16. Copyright example42 GmbH - 2016 Lookup Priority • Hiera -> Global Overrides ! • Environment Data -> Core Puppet Lookup ! • Module Data -> Defaults
  • 17. Copyright example42 GmbH - 2016 Lookup Functions • Explicit lookup: lookup(‘key’)! ! • CLI lookup: puppet lookup ‘key’ ! • Automatic lookup: ‘<namespace>::<key>’
  • 18. Copyright example42 GmbH - 2016 Lookup Functions • lookup(‘key’, <Type>, <merge_behavior>, <default>)! • e.g. lookup(‘ntp_servers’, Array) • Merge behavior: • first! • unique (array merge)! • hash! • deep!
  • 19. Copyright example42 GmbH - 2016 Data Provider Configuration • Global Environment Provider: puppet.conf • environment_data_provider = <data provider>! ! ! !
  • 20. Copyright example42 GmbH - 2016 Data Provider Configuration • Global Environment Provider: puppet.conf • environment_data_provider = <data provider>! • Environment Provider: environment.conf • environment_data_provider = <data provider>! !
  • 21. Copyright example42 GmbH - 2016 Data Provider Configuration • Global Environment Provider: puppet.conf • environment_data_provider = <data provider>! • Environment Provider: environment.conf • environment_data_provider = <data provider>! • Module Provider: metadata.json • “data_provider”: “<data provider>”
  • 22. Copyright example42 GmbH - 2016 Data Provider • none -> standard hiera lookup ! • hiera -> hiera lookup (hiera v4) ! • function -> data function lookup
  • 23. Copyright example42 GmbH - 2016 Data Provider Hiera • replace hiera, hiera_array, hiera_hash with ‘lookup’ • needs hiera.yaml v4 configuration file • set data_provider to ‘hiera’ in puppet.conf, environment.conf or metadata.json • modify global hiera.yaml to use datadir outside environment
  • 24. Copyright example42 GmbH - 2016 Data Provider Hiera # /etc/puppetlabs/code/environments/production/hiera.yaml # /etc/puppetlabs/code/environments/production/modules/<module>/ hiera.yaml # - - -! version: 4! datadir: hieradata! hierarchy:! - name: “Nodes”! backend: yaml! path: “nodes/%{trusted.certname}”! - name: “OS”! backend: json! path: “os/%{facts.os.family}”! - name: “common”! backend: yaml
  • 25. Copyright example42 GmbH - 2016 Data Provider Function • write data function • Puppet 4 Function • <module>/functions/<module>/data.pp • <env>/functions/<env>/data.pp • set data_provider to function in puppet.conf, environment.conf or metadata.json
  • 26. Copyright example42 GmbH - 2016 Data Provider Function - Puppet # ntp/functions/ntp/data.pp function ntp::data() {! $params = {! ‘ntp::ntpservers’ => [‘pool.ntp.org’],! }! $os_params = case $facts[‘os’][‘family’] {! ‘Debian’: {! { ‘ntp::ntpackage’ => ‘ntpd’, }! },! default: {! {}! }! }! $params + $os_params! }
  • 27. Copyright example42 GmbH - 2016 Data Provider Function • write data function • Ruby Function (Puppet 4 function API) • <module>/lib/puppet/functions/<module>/ data.rb • <env>/lib/puppet/functions/<env>/data.rb • set data_provider to function in puppet.conf, environment.conf or metadata.json
  • 28. Copyright example42 GmbH - 2016 Data Provider Function - Ruby # ntp/lib/puppet/functions/ntp/data.rb Puppet::Functions.create_function(:’ntp::data’) do! def base_data()! { ‘ntp::ntpservers’ => [‘pool.ntp.org’], }! end! def os_data()! case Facter.value(:os)[‘family’]! when ‘Debian’! { ‘ntp::pkgname’ => ‘ntpd’, }! else! {}! end! def data()! self.base_data.merge!(self.os_data)! end! end
  • 29. Copyright example42 GmbH - 2016 Data in Component Modules Image: Tatlin - tatlin.net
  • 30. Copyright example42 GmbH - 2016 Data in Component Modules • add data provider to metadata.json • provide OS defaults • remove params.pp / remove inheritance • allow users to overwrite any data
  • 31. Copyright example42 GmbH - 2016 Data Provider Function - Ruby # my_ntp/manifests/init.pp class my_ntp (! $server = $my_ntp::params::server,! $pkgname = $my_ntp::params::pkgname,! $secure = $my_ntp::params::secure,! ) inherits my_ntp::params {! # ...! }!
  • 32. Copyright example42 GmbH - 2016 Data in Environments Image: Tatlin - tatlin.net
  • 33. Copyright example42 GmbH - 2016 Data in Environments • old hiera replacement • add hiera.yaml to environment base path • overwrite data from modules, roles & profiles
  • 34. Copyright example42 GmbH - 2016 Summary Image: Tatlin - tatlin.net
  • 35. Copyright example42 GmbH - 2016 Summary # /etc/puppetlabs/code/ ! ! hiera.yaml! ! ! hieradata/! ! ! environments/production/ ! ! ! ! ! ! environment.conf! ! ! ! ! ! ! hiera.yaml! ! ! ! ! ! ! hieradata/! modules/my_module/ ! ! ! ! ! ! ! ! ! ! metadata.json! ! ! ! ! ! ! ! ! ! ! hiera.yaml! ! ! ! ! ! ! ! ! ! ! hieradata/
  • 36. Copyright example42 GmbH - 2016 Summary # /etc/puppetlabs/code/ ! ! hiera.yaml! ! ! hieradata/! ! ! environments/production/ ! ! ! ! ! environment.conf! ! ! ! ! ! lib/functions/data.pp! ! ! ! ! ! lib/puppet/functions/ ! ! ! ! ! ! ! ! ! production/data.rb! modules/my_module/ ! ! ! ! ! ! !! ! metadata.json! ! ! ! ! ! ! ! ! lib/functions/data.pp! ! ! ! ! ! ! ! ! lib/puppet/functions/ ! ! ! ! ! ! ! ! ! ! ! ! my_module/data.rb
  • 37. Copyright example42 GmbH - 2016 Summary - Pro • Per hierarchy Hiera Data backend possible • Data Function lookups without need for hiera backend (e.g. Cloud Management API data) • No more inheritance required
  • 38. Copyright example42 GmbH - 2016 Summary - Con • No single Source of Authority? • Debugging can be complex when iterating over many data providers and hierarchies
  • 39. Copyright example42 GmbH - 2016 Module Developers • switch to data in modules • give users the possibility to provide own data • allow users to overwrite any data • allow users to know their data for missing OS support
  • 40. Copyright example42 GmbH - 2016 Module Users • switch to hieradata in modules then • switch to data in environments • keep data simple and readable • don’t overcomplicate !
  • 41. Copyright example42 GmbH - 2016 Module Users • hieradata common.yaml my_ntp: ‘pool.ntp.org’! apache::default_mods: false! apache::purge_configs: true! mysql::remove_default_accounts: true! mysql::root_password: ‘puppet’! oradb::database::version: ’12.1’! oradb::shout: ‘MISSING DATA’
  • 42. Copyright example42 GmbH - 2016 References • http://docs.puppetlabs.com/puppet/4.3/reference/ lookup_quick.html • http://docs.puppetlabs.com/puppet/4.3/reference/ lookup_quick_module.html • http://puppet-on-the-edge.blogspot.de/2015/01/ puppet-40-data-in-modules-and.html
  • 43. Copyright example42 GmbH - 2016 Puppet 4 - Data in modules PuppetCamp Paris 2016 Martin Alfke - ma@example42.com Image: Tatlin - tatlin.net Copyright example42 GmbH - 2016