SlideShare a Scribd company logo
1 of 47
Download to read offline
Our Puppet Story – Patterns and
Learnings
Martin Schütte
March 27 2014
1. Intro
2. Vagrant
3. Puppet
Intro
Dashboard & PE
Facter & Hiera
git
Problems
Misc
1. Intro
2. Vagrant
3. Puppet
Intro
Dashboard & PE
Facter & Hiera
git
Problems
Misc
About DECK36
• Small team of 7 engineers
• Longstanding expertise in designing, implementing and operating
complex web systems
• Developing own data intelligence-focused tools and web services
• Offering our expert knowledge in Automation & Operation,
Architecture & Engineering, Analytics & Data Logistics
About me
• System Automation Engineer
• Puppet Certified Professional 2013
• martin.schuette@deck36.de
The Problem
The Goal
Stable and reproducible environment for a Software.
… environment for new developer,
… test config changes,
… clean package build env,
… preconfigured demo box.
But also quickly deployable, and centrally managed
with current software versions.
1. Intro
2. Vagrant
3. Puppet
Intro
Dashboard & PE
Facter & Hiera
git
Problems
Misc
Vagrant
Configuration tool for VMs and Provisioning.
“Local cloud”
• Self service
• Instant provisioning
• Cost efficient
• Elastic
• Pay per use
Vagrant
VM Providers:
• VirtualBox: “default”, works offline, ressource hungry
• Docker: lightweight, requires Linux, good for testing
• AWS EC2: remote VMs, good for automation (Jenkins)
Provisioning:
• Shell script
• Puppet, apply manifest or run agent
• Chef, solo or client
• Ansible playbooks
• Salt states
• Docker containers
VeeWee definition
Veewee::Definition.declare({
:iso_file => "debian-wheezy-DI-b4-amd64-netinst.iso",
:disk_size => '40560', :disk_format => 'VDI',
:cpu_count => '2', :memory_size => '3192',
:boot_wait => "10", :boot_cmd_sequence => [
'<Esc>', 'install ',
'preseed/url=http://%IP%:%PORT%/preseed.cfg ',
'debconf/frontend=noninteractive ', '<Enter>'
],
:postinstall_files => [
"base.sh", "vagrant.sh", "customize-puppet.sh", ...
],
...
})
Vagrantfile
Vagrant.configure("2") do |config|
config.vm.box = "graylog2"
config.vm.box_url = "http://vagrantboxes.footballradar.com/wheezy64.box"
config.vm.provider "virtualbox" do |v|
v.memory = 1024
end
config.vm.provision :puppet do |puppet|
puppet.manifest_file = "graylog2.pp"
puppet.module_path = "modules"
end
config.vm.network :forwarded_port, guest: 9000, host: 9000
config.vm.network :forwarded_port, guest: 80, host: 8080
config.vm.network :forwarded_port, guest: 12201, host: 12201, protocol: 'udp'
config.vm.network :forwarded_port, guest: 12201, host: 12201, protocol: 'tcp'
config.vm.network :forwarded_port, guest: 12900, host: 12900
end
Multi-VM Vagrantfile
Vagrant.configure("2") do |config|
# VM 1: appserver
config.vm.define :app do |app|
app.vm.hostname = "testbox.example.org"
app.vm.network :forwarded_port, host: 8080, guest: 80
app.vm.synced_folder ".", "/home/vagrant/files"
end
# VM 2: DB server
config.vm.define :db do |db|
db.vm.hostname = "db.example.org"
db.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--cpus", "2"]
end
end
# Box & Provisioning
config.vm.box = "precise64"
config.vm.provision :shell,
:path => "vagrant_install_puppet_keys.sh"
config.vm.provision :puppet_server,
:puppet_server => "puppetmaster.example.org"
end
vagrant-aws
Vagrant.configure("2") do |config|
config.vm.box = "dummy"
config.vm.provider :aws do |aws, override|
aws.access_key_id = "YOUR KEY"
aws.secret_access_key = "YOUR SECRET KEY"
aws.keypair_name = "KEYPAIR NAME"
region = "eu-west-1"
aws.ami = "ami-20414854"
aws.tags = {
'Role' => 'TestVM',
'Net' => 'Devnet'
}
end
end
Synced Folders
Shared folders, mounted from host into guest.
Options:
• VirtualBox
• NFS
• SMB
• rsync
Synced Folders
src: Mitchell Hashimoto, Comparing Filesystem Performance in Virtual Machines
1. Intro
2. Vagrant
3. Puppet
Intro
Dashboard & PE
Facter & Hiera
git
Problems
Misc
Puppet
• Configuration Management
• Declarative: Resources and Dependencies
Puppet
Puppet Agent execution:
1. Create catalog:
• read manifest
• gather resources
• ensure order
2. Apply for each resource:
• query state
• change to desired state
Syntax
class vpn($version = 'present', $ca_crt, $usr_crt, $usr_key) {
package {
'openvpn':
ensure => $version;
}
file {
"/etc/openvpn/client.key":
ensure => file,
mode => '0600',
content => $usr_key;
require => Package['openvpn'],
notify => Service['openvpn'];
"/etc/openvpn/client.conf":
ensure => file,
source => "puppet:///modules/vpn/client.conf",
require => Package['openvpn'],
notify => Service['openvpn'];
}
service { 'openvpn':
ensure => running,
require => Package['openvpn'],
}
}
Syntax
class vpn($version = 'present', $ca_crt, $usr_crt, $usr_key) {
package {
'openvpn':
ensure => $version;
}
->
file {
"/etc/openvpn/client.key":
ensure => file,
mode => '0600',
content => $usr_key;
"/etc/openvpn/client.conf":
ensure => file,
source => "puppet:///modules/vpn/client.conf";
}
~>
service { 'openvpn':
ensure => running,
}
}
Relationships
Class[Vpn]
Package[openvpn]
File[/etc/openvpn/client.key] File[/etc/openvpn/client.conf]
Service[openvpn]
Puppet Module Layout
module_name
• manifests Puppet code (classes/defines)
- init.pp
- subclass.pp
• files static files
• templates .erb templates
• lib ruby plugins (custom types/facts)
• tests usage examples for manifests
• spec spec tests for libs
Puppet Dashboard
External Monitoring
stdlib facts.d
• simple data input
• e. g. ec2metadata, inventory lookup
custom_facts.sh
#! /bin/sh
which ec2metadata >/dev/null 2>&1 || exit 1
echo "ec2_ami_id=$(ec2metadata --ami-id)"
echo "ec2_instance_id=$(ec2metadata --instance-id)"
echo "ec2_instance_type=$(ec2metadata --instance-type)"
echo "ec2_public_ipv4=$(ec2metadata --public-ipv4)"
echo "ec2_public_hostname=$(ec2metadata --public-hostname)"
Hiera
• banish top scope variables
• use Hiera!
• structure with roles & profiles
node definitions vs. Hiera
site.pp
node "mydev.vagrantup.com" inherits basenode-vagrant {
$vmEnv = "development"
include sysadmin
include ntp
include vagrant
include user::vagrant
include mysqlserver
include redisserver
# ...
}
node definitions vs. Hiera
site.pp
hiera_include('include_classes', ['sysadmin'])
node default {
}
role_elasticsearch.yaml
include_classes:
- elasticsearch
- elasticsearch::plugins
- zabbix::helper::elasticsearch
elasticsearch::clustername: "mycluster"
elasticsearch::client: false
elasticsearch::heapsize: "768m"
hiera.yaml
:hierarchy:
- node/%{fqdn}
- vm/netenv_role_%{puppet_netenv}_%{puppet_role}
- vm/role_%{puppet_role}
- vm/netenv_%{puppet_netenv}
- domain_%{domain}
- common
:backends:
- yaml
:logger: console
:yaml:
:datadir: "/etc/puppet/environments/%{environment}/"
Example lookup
fqdn = dev.pod1.org
domain = pod1.org
puppet_role = dev
puppet_netenv = vagrant
⇒ Lookup in:
1. node/dev.pod1.org.yaml
2. vm/netenv_role_vagrant_dev.yaml
3. vm/role_dev.yaml
4. vm/netenv_vagrant.yaml
5. domain_pod1.org.yaml
6. common.yaml
Hiera & Puppet 2.x compatibility
class vpn($version = hiera('vpn::version', 'present'),
$ca_crt = hiera('vpn::ca_crt'),
$usr_crt = hiera('vpn::usr_crt'),
$usr_key = hiera('vpn::usr_key')) {
package {
'openvpn':
ensure => $version;
}
# ...
}
git workflow
• use git!
• use git hooks
• use per-user environments for easy testing
• repos for testing/production
git hook: Syntax Check
Git pre-commit hook with puppet-lint to syntax check Puppet, ERB
templates, YAML files (http://github.com/gini/puppet-git-hooks)
Example Output:
$ git commit -m 'test' modules/graylog2/templates/server.conf.erb
-:5: syntax error, unexpected $undefined
...rd_sha2 = "; _erbout.concat(( @ root_pwd_sha2 ).to_s); _erbo...
... ^
ERB syntax error in modules/graylog2/templates/server.conf.erb
git hook: E-Mail Notification
Git post-receive hook to notify team on push
(http://git.kernel.org/cgit/git/git.git/tree/contrib/hooks/
post-receive-email?id=HEAD)
Example E-Mail:
- Log ----------------------------------------------
commit 5df04ee883b8de8a37bf0ac97eec068cd1f3a414
Author: N. N. <n.n@deck36.de>
Date: Tue Jan 7 08:57:17 2014 +0000
fixed path to csync2 executable
----------------------------------------------------
Summary of changes:
modules/user/files/etc/sudoers.d/support | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
environments
• per user env + production
⇒ easy testing with puppet agent -t --environment=user
• two servers for testing/production
Config (in puppet < 3.5.0):
puppet.conf
[mschuette]
modulepath = $confdir/environments/mschuette/modules
manifest = $confdir/environments/mschuette/manifests/site.pp
pluginsync = true
environments
..dev-master. prod-master.
user1
.user2 .
user3
.
…
.
Dev/Test
.
Prod
Puppet Problems
• some tasks require two agent runs
• apt-get upgrade and package dependencies
• beware of version mismatch between apt (or yum) and package
• scoping and namespaces
• exec is the new eval
Version ping-pong
modules/php/init.pp
class php($version = '5.3.10-1ubuntu3.10') {
package { 'php5-common':
ensure => $version,
}
}
class php::curl($version) {
require php
package { 'php5-curl':
ensure => $version,
}
}
server.pp
class { 'php::curl':
version => '5.5.5+dfsg-1+debphp.org~precise+2',
}
Namespace problems
# this does not work, cf. #PUP-1073
package { 'memcached':
ensure => present,
provider => apt,
}
package { 'memcached':
ensure => present,
provider => gem,
}
exec tricks
You can do (and break) everything with exec.
But of course you should not.
exec tricks
# no pkg provider for npm
exec { 'npm install -g less':
creates => '/usr/lib/node_modules/npm/node_modules/less',
}
# hide change
exec { 'zabbix_update.sh':
command => 'false',
onlyif => "/opt/zabbix_update.sh $api_url && false",
logoutput => on_failure,
}
MCollective
“multissh deluxe”
AMQP client/server framework to
• orchestrate actions
• control puppet agents
• run commands
• query resources
• …
Hooks to other systems
• include in provisioning process
• provide normative data as facts
• register or update DNS name → Route 53
• register or update host in Zabbix monitoring → API
Versions
• Puppet 2.7: legacy
• Puppet 3.0: major upgrade, with Hiera support
• Puppet 3.x: current development, future parser
Questions?
class presentation {
package { 'questions':
ensure => 'answered',
}
}
Links:
• Vagrant
• Puppet Language: Visual Index
• Puppet Type Reference
• Puppet Ask
Thank You

More Related Content

What's hot

Introduction to apache zoo keeper
Introduction to apache zoo keeper Introduction to apache zoo keeper
Introduction to apache zoo keeper Omid Vahdaty
 
Distributed system coordination by zookeeper and introduction to kazoo python...
Distributed system coordination by zookeeper and introduction to kazoo python...Distributed system coordination by zookeeper and introduction to kazoo python...
Distributed system coordination by zookeeper and introduction to kazoo python...Jimmy Lai
 
Ansible not only for Dummies
Ansible not only for DummiesAnsible not only for Dummies
Ansible not only for DummiesŁukasz Proszek
 
[오픈소스컨설팅] 프로메테우스 모니터링 살펴보고 구성하기
[오픈소스컨설팅] 프로메테우스 모니터링 살펴보고 구성하기[오픈소스컨설팅] 프로메테우스 모니터링 살펴보고 구성하기
[오픈소스컨설팅] 프로메테우스 모니터링 살펴보고 구성하기Ji-Woong Choi
 
Herd your chickens: Ansible for DB2 configuration management
Herd your chickens: Ansible for DB2 configuration managementHerd your chickens: Ansible for DB2 configuration management
Herd your chickens: Ansible for DB2 configuration managementFrederik Engelen
 
How and Why Prometheus' New Storage Engine Pushes the Limits of Time Series D...
How and Why Prometheus' New Storage Engine Pushes the Limits of Time Series D...How and Why Prometheus' New Storage Engine Pushes the Limits of Time Series D...
How and Why Prometheus' New Storage Engine Pushes the Limits of Time Series D...Docker, Inc.
 
Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.Łukasz Proszek
 
Introduction to Apache ZooKeeper
Introduction to Apache ZooKeeperIntroduction to Apache ZooKeeper
Introduction to Apache ZooKeeperSaurav Haloi
 
Getting started with Ansible
Getting started with AnsibleGetting started with Ansible
Getting started with AnsibleIvan Serdyuk
 
Automation with Ansible and Containers
Automation with Ansible and ContainersAutomation with Ansible and Containers
Automation with Ansible and ContainersRodolfo Carvalho
 
Fixing Growing Pains With Puppet Data Patterns
Fixing Growing Pains With Puppet Data PatternsFixing Growing Pains With Puppet Data Patterns
Fixing Growing Pains With Puppet Data PatternsMartin Jackson
 
PostgreSQL Extensions: A deeper look
PostgreSQL Extensions:  A deeper lookPostgreSQL Extensions:  A deeper look
PostgreSQL Extensions: A deeper lookJignesh Shah
 
Docker on openstack by OpenSource Consulting
Docker on openstack by OpenSource ConsultingDocker on openstack by OpenSource Consulting
Docker on openstack by OpenSource ConsultingOpen Source Consulting
 
Apache zookeeper 101
Apache zookeeper 101Apache zookeeper 101
Apache zookeeper 101Quach Tung
 
Advanced task management with Celery
Advanced task management with CeleryAdvanced task management with Celery
Advanced task management with CeleryMahendra M
 
Automated Java Deployments With Rpm
Automated Java Deployments With RpmAutomated Java Deployments With Rpm
Automated Java Deployments With RpmMartin Jackson
 
Zookeeper In Simple Words
Zookeeper In Simple WordsZookeeper In Simple Words
Zookeeper In Simple WordsFuqiang Wang
 
Managing PostgreSQL with Ansible - FOSDEM PGDay 2016
Managing PostgreSQL with Ansible - FOSDEM PGDay 2016Managing PostgreSQL with Ansible - FOSDEM PGDay 2016
Managing PostgreSQL with Ansible - FOSDEM PGDay 2016Gulcin Yildirim Jelinek
 
PuppetConf 2016: Nano Server, Puppet, and DSC
PuppetConf 2016: Nano Server, Puppet, and DSCPuppetConf 2016: Nano Server, Puppet, and DSC
PuppetConf 2016: Nano Server, Puppet, and DSCMichael Smith
 

What's hot (20)

Introduction to apache zoo keeper
Introduction to apache zoo keeper Introduction to apache zoo keeper
Introduction to apache zoo keeper
 
Build Automation 101
Build Automation 101Build Automation 101
Build Automation 101
 
Distributed system coordination by zookeeper and introduction to kazoo python...
Distributed system coordination by zookeeper and introduction to kazoo python...Distributed system coordination by zookeeper and introduction to kazoo python...
Distributed system coordination by zookeeper and introduction to kazoo python...
 
Ansible not only for Dummies
Ansible not only for DummiesAnsible not only for Dummies
Ansible not only for Dummies
 
[오픈소스컨설팅] 프로메테우스 모니터링 살펴보고 구성하기
[오픈소스컨설팅] 프로메테우스 모니터링 살펴보고 구성하기[오픈소스컨설팅] 프로메테우스 모니터링 살펴보고 구성하기
[오픈소스컨설팅] 프로메테우스 모니터링 살펴보고 구성하기
 
Herd your chickens: Ansible for DB2 configuration management
Herd your chickens: Ansible for DB2 configuration managementHerd your chickens: Ansible for DB2 configuration management
Herd your chickens: Ansible for DB2 configuration management
 
How and Why Prometheus' New Storage Engine Pushes the Limits of Time Series D...
How and Why Prometheus' New Storage Engine Pushes the Limits of Time Series D...How and Why Prometheus' New Storage Engine Pushes the Limits of Time Series D...
How and Why Prometheus' New Storage Engine Pushes the Limits of Time Series D...
 
Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.
 
Introduction to Apache ZooKeeper
Introduction to Apache ZooKeeperIntroduction to Apache ZooKeeper
Introduction to Apache ZooKeeper
 
Getting started with Ansible
Getting started with AnsibleGetting started with Ansible
Getting started with Ansible
 
Automation with Ansible and Containers
Automation with Ansible and ContainersAutomation with Ansible and Containers
Automation with Ansible and Containers
 
Fixing Growing Pains With Puppet Data Patterns
Fixing Growing Pains With Puppet Data PatternsFixing Growing Pains With Puppet Data Patterns
Fixing Growing Pains With Puppet Data Patterns
 
PostgreSQL Extensions: A deeper look
PostgreSQL Extensions:  A deeper lookPostgreSQL Extensions:  A deeper look
PostgreSQL Extensions: A deeper look
 
Docker on openstack by OpenSource Consulting
Docker on openstack by OpenSource ConsultingDocker on openstack by OpenSource Consulting
Docker on openstack by OpenSource Consulting
 
Apache zookeeper 101
Apache zookeeper 101Apache zookeeper 101
Apache zookeeper 101
 
Advanced task management with Celery
Advanced task management with CeleryAdvanced task management with Celery
Advanced task management with Celery
 
Automated Java Deployments With Rpm
Automated Java Deployments With RpmAutomated Java Deployments With Rpm
Automated Java Deployments With Rpm
 
Zookeeper In Simple Words
Zookeeper In Simple WordsZookeeper In Simple Words
Zookeeper In Simple Words
 
Managing PostgreSQL with Ansible - FOSDEM PGDay 2016
Managing PostgreSQL with Ansible - FOSDEM PGDay 2016Managing PostgreSQL with Ansible - FOSDEM PGDay 2016
Managing PostgreSQL with Ansible - FOSDEM PGDay 2016
 
PuppetConf 2016: Nano Server, Puppet, and DSC
PuppetConf 2016: Nano Server, Puppet, and DSCPuppetConf 2016: Nano Server, Puppet, and DSC
PuppetConf 2016: Nano Server, Puppet, and DSC
 

Viewers also liked

Revista33
Revista33Revista33
Revista33fedamon
 
Download the complete course information(.doc)
Download the complete course information(.doc)Download the complete course information(.doc)
Download the complete course information(.doc)butest
 
Organizing used parts in the DIY bicycle shop
Organizing used parts in the DIY bicycle shopOrganizing used parts in the DIY bicycle shop
Organizing used parts in the DIY bicycle shopcmirch
 
Actividad 1 cognicion
Actividad 1 cognicionActividad 1 cognicion
Actividad 1 cognicionjuan carlos
 
Historia de la Hotelería de Manta - Manabí - Ecuador
Historia de la Hotelería de Manta - Manabí - EcuadorHistoria de la Hotelería de Manta - Manabí - Ecuador
Historia de la Hotelería de Manta - Manabí - Ecuadoredubeto texeira
 
deep books catalague 2015 - Health & Complementary Therapies
deep books catalague 2015 - Health & Complementary Therapiesdeep books catalague 2015 - Health & Complementary Therapies
deep books catalague 2015 - Health & Complementary Therapiesdeepbooks
 
Figures of Absence in the History of Art
Figures of Absence in the History of ArtFigures of Absence in the History of Art
Figures of Absence in the History of ArtPino Blasone
 
Perini 2007_Annual_Report
Perini 2007_Annual_ReportPerini 2007_Annual_Report
Perini 2007_Annual_Reportfinance50
 
Primera reunión comunidad tecnológica 06 05-2010
Primera reunión comunidad tecnológica 06 05-2010Primera reunión comunidad tecnológica 06 05-2010
Primera reunión comunidad tecnológica 06 05-2010Erick Rojas Figueroa
 
Things to remember before taking your sol, notes for students
Things to remember before taking your sol, notes for studentsThings to remember before taking your sol, notes for students
Things to remember before taking your sol, notes for studentsLanelle Hilling
 
CORE: Cognitive Organization for Requirements Elicitation
CORE: Cognitive Organization for Requirements ElicitationCORE: Cognitive Organization for Requirements Elicitation
CORE: Cognitive Organization for Requirements ElicitationScott M. Confer
 
Lean Mfg Takeawayssharing
Lean Mfg TakeawayssharingLean Mfg Takeawayssharing
Lean Mfg TakeawayssharingFNian
 

Viewers also liked (20)

Revista33
Revista33Revista33
Revista33
 
Presentación Xorcom - Nordata
Presentación Xorcom - NordataPresentación Xorcom - Nordata
Presentación Xorcom - Nordata
 
Diccionario informático
Diccionario informáticoDiccionario informático
Diccionario informático
 
Download the complete course information(.doc)
Download the complete course information(.doc)Download the complete course information(.doc)
Download the complete course information(.doc)
 
Organizing used parts in the DIY bicycle shop
Organizing used parts in the DIY bicycle shopOrganizing used parts in the DIY bicycle shop
Organizing used parts in the DIY bicycle shop
 
Ideas prácticas para emprendedores
Ideas prácticas para emprendedoresIdeas prácticas para emprendedores
Ideas prácticas para emprendedores
 
Actividad 1 cognicion
Actividad 1 cognicionActividad 1 cognicion
Actividad 1 cognicion
 
Historia de la Hotelería de Manta - Manabí - Ecuador
Historia de la Hotelería de Manta - Manabí - EcuadorHistoria de la Hotelería de Manta - Manabí - Ecuador
Historia de la Hotelería de Manta - Manabí - Ecuador
 
deep books catalague 2015 - Health & Complementary Therapies
deep books catalague 2015 - Health & Complementary Therapiesdeep books catalague 2015 - Health & Complementary Therapies
deep books catalague 2015 - Health & Complementary Therapies
 
Figures of Absence in the History of Art
Figures of Absence in the History of ArtFigures of Absence in the History of Art
Figures of Absence in the History of Art
 
Goethe werther
Goethe   wertherGoethe   werther
Goethe werther
 
JSI Swish Brochure
JSI Swish BrochureJSI Swish Brochure
JSI Swish Brochure
 
Perini 2007_Annual_Report
Perini 2007_Annual_ReportPerini 2007_Annual_Report
Perini 2007_Annual_Report
 
Primera reunión comunidad tecnológica 06 05-2010
Primera reunión comunidad tecnológica 06 05-2010Primera reunión comunidad tecnológica 06 05-2010
Primera reunión comunidad tecnológica 06 05-2010
 
Gracias4b2
Gracias4b2Gracias4b2
Gracias4b2
 
Things to remember before taking your sol, notes for students
Things to remember before taking your sol, notes for studentsThings to remember before taking your sol, notes for students
Things to remember before taking your sol, notes for students
 
6ta Clase Modelos a escala
6ta Clase Modelos a escala6ta Clase Modelos a escala
6ta Clase Modelos a escala
 
CORE: Cognitive Organization for Requirements Elicitation
CORE: Cognitive Organization for Requirements ElicitationCORE: Cognitive Organization for Requirements Elicitation
CORE: Cognitive Organization for Requirements Elicitation
 
Lean Mfg Takeawayssharing
Lean Mfg TakeawayssharingLean Mfg Takeawayssharing
Lean Mfg Takeawayssharing
 
TD Systems Information
TD Systems InformationTD Systems Information
TD Systems Information
 

Similar to Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)

Our Puppet Story (Linuxtag 2014)
Our Puppet Story (Linuxtag 2014)Our Puppet Story (Linuxtag 2014)
Our Puppet Story (Linuxtag 2014)DECK36
 
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
 
Jenkins Pipelines Advanced
Jenkins Pipelines AdvancedJenkins Pipelines Advanced
Jenkins Pipelines AdvancedOliver Lemm
 
Linux Desktop Automation
Linux Desktop AutomationLinux Desktop Automation
Linux Desktop AutomationRui Lapa
 
Chef arista devops days a'dam 2015
Chef arista devops days a'dam 2015Chef arista devops days a'dam 2015
Chef arista devops days a'dam 2015Edwin Beekman
 
Postgres the hardway
Postgres the hardwayPostgres the hardway
Postgres the hardwayDave Pitts
 
DB proxy server test: run tests on tens of virtual machines with Jenkins, Vag...
DB proxy server test: run tests on tens of virtual machines with Jenkins, Vag...DB proxy server test: run tests on tens of virtual machines with Jenkins, Vag...
DB proxy server test: run tests on tens of virtual machines with Jenkins, Vag...Timofey Turenko
 
PaaSTA: Autoscaling at Yelp
PaaSTA: Autoscaling at YelpPaaSTA: Autoscaling at Yelp
PaaSTA: Autoscaling at YelpNathan Handler
 
(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...
(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...
(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...Amazon Web Services
 
Jacopo Nardiello - Monitoring Cloud-Native applications with Prometheus - Cod...
Jacopo Nardiello - Monitoring Cloud-Native applications with Prometheus - Cod...Jacopo Nardiello - Monitoring Cloud-Native applications with Prometheus - Cod...
Jacopo Nardiello - Monitoring Cloud-Native applications with Prometheus - Cod...Codemotion
 
Incrementalism: An Industrial Strategy For Adopting Modern Automation
Incrementalism: An Industrial Strategy For Adopting Modern AutomationIncrementalism: An Industrial Strategy For Adopting Modern Automation
Incrementalism: An Industrial Strategy For Adopting Modern AutomationSean Chittenden
 
Exploring the Final Frontier of Data Center Orchestration: Network Elements -...
Exploring the Final Frontier of Data Center Orchestration: Network Elements -...Exploring the Final Frontier of Data Center Orchestration: Network Elements -...
Exploring the Final Frontier of Data Center Orchestration: Network Elements -...Puppet
 
Openstack Third-Party CI and the review of a few Openstack Infrastructure pro...
Openstack Third-Party CI and the review of a few Openstack Infrastructure pro...Openstack Third-Party CI and the review of a few Openstack Infrastructure pro...
Openstack Third-Party CI and the review of a few Openstack Infrastructure pro...Evgeny Antyshev
 
Ansible benelux meetup - Amsterdam 27-5-2015
Ansible benelux meetup - Amsterdam 27-5-2015Ansible benelux meetup - Amsterdam 27-5-2015
Ansible benelux meetup - Amsterdam 27-5-2015Pavel Chunyayev
 
Monitoring_with_Prometheus_Grafana_Tutorial
Monitoring_with_Prometheus_Grafana_TutorialMonitoring_with_Prometheus_Grafana_Tutorial
Monitoring_with_Prometheus_Grafana_TutorialTim Vaillancourt
 
Dockerizing the Hard Services: Neutron and Nova
Dockerizing the Hard Services: Neutron and NovaDockerizing the Hard Services: Neutron and Nova
Dockerizing the Hard Services: Neutron and Novaclayton_oneill
 
Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Cosimo Streppone
 

Similar to Our Puppet Story – Patterns and Learnings (sage@guug, March 2014) (20)

Our Puppet Story (Linuxtag 2014)
Our Puppet Story (Linuxtag 2014)Our Puppet Story (Linuxtag 2014)
Our Puppet Story (Linuxtag 2014)
 
Our Puppet Story (GUUG FFG 2015)
Our Puppet Story (GUUG FFG 2015)Our Puppet Story (GUUG FFG 2015)
Our Puppet Story (GUUG FFG 2015)
 
Jenkins Pipelines Advanced
Jenkins Pipelines AdvancedJenkins Pipelines Advanced
Jenkins Pipelines Advanced
 
Linux Desktop Automation
Linux Desktop AutomationLinux Desktop Automation
Linux Desktop Automation
 
Chef arista devops days a'dam 2015
Chef arista devops days a'dam 2015Chef arista devops days a'dam 2015
Chef arista devops days a'dam 2015
 
Puppet evolutions
Puppet evolutionsPuppet evolutions
Puppet evolutions
 
Postgres the hardway
Postgres the hardwayPostgres the hardway
Postgres the hardway
 
DB proxy server test: run tests on tens of virtual machines with Jenkins, Vag...
DB proxy server test: run tests on tens of virtual machines with Jenkins, Vag...DB proxy server test: run tests on tens of virtual machines with Jenkins, Vag...
DB proxy server test: run tests on tens of virtual machines with Jenkins, Vag...
 
PaaSTA: Autoscaling at Yelp
PaaSTA: Autoscaling at YelpPaaSTA: Autoscaling at Yelp
PaaSTA: Autoscaling at Yelp
 
Cooking with Chef
Cooking with ChefCooking with Chef
Cooking with Chef
 
(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...
(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...
(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...
 
Jacopo Nardiello - Monitoring Cloud-Native applications with Prometheus - Cod...
Jacopo Nardiello - Monitoring Cloud-Native applications with Prometheus - Cod...Jacopo Nardiello - Monitoring Cloud-Native applications with Prometheus - Cod...
Jacopo Nardiello - Monitoring Cloud-Native applications with Prometheus - Cod...
 
Incrementalism: An Industrial Strategy For Adopting Modern Automation
Incrementalism: An Industrial Strategy For Adopting Modern AutomationIncrementalism: An Industrial Strategy For Adopting Modern Automation
Incrementalism: An Industrial Strategy For Adopting Modern Automation
 
Gradle como alternativa a maven
Gradle como alternativa a mavenGradle como alternativa a maven
Gradle como alternativa a maven
 
Exploring the Final Frontier of Data Center Orchestration: Network Elements -...
Exploring the Final Frontier of Data Center Orchestration: Network Elements -...Exploring the Final Frontier of Data Center Orchestration: Network Elements -...
Exploring the Final Frontier of Data Center Orchestration: Network Elements -...
 
Openstack Third-Party CI and the review of a few Openstack Infrastructure pro...
Openstack Third-Party CI and the review of a few Openstack Infrastructure pro...Openstack Third-Party CI and the review of a few Openstack Infrastructure pro...
Openstack Third-Party CI and the review of a few Openstack Infrastructure pro...
 
Ansible benelux meetup - Amsterdam 27-5-2015
Ansible benelux meetup - Amsterdam 27-5-2015Ansible benelux meetup - Amsterdam 27-5-2015
Ansible benelux meetup - Amsterdam 27-5-2015
 
Monitoring_with_Prometheus_Grafana_Tutorial
Monitoring_with_Prometheus_Grafana_TutorialMonitoring_with_Prometheus_Grafana_Tutorial
Monitoring_with_Prometheus_Grafana_Tutorial
 
Dockerizing the Hard Services: Neutron and Nova
Dockerizing the Hard Services: Neutron and NovaDockerizing the Hard Services: Neutron and Nova
Dockerizing the Hard Services: Neutron and Nova
 
Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013
 

Recently uploaded

Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 

Recently uploaded (20)

Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 

Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)

  • 1. Our Puppet Story – Patterns and Learnings Martin Schütte March 27 2014
  • 2. 1. Intro 2. Vagrant 3. Puppet Intro Dashboard & PE Facter & Hiera git Problems Misc
  • 3. 1. Intro 2. Vagrant 3. Puppet Intro Dashboard & PE Facter & Hiera git Problems Misc
  • 4. About DECK36 • Small team of 7 engineers • Longstanding expertise in designing, implementing and operating complex web systems • Developing own data intelligence-focused tools and web services • Offering our expert knowledge in Automation & Operation, Architecture & Engineering, Analytics & Data Logistics
  • 5. About me • System Automation Engineer • Puppet Certified Professional 2013 • martin.schuette@deck36.de
  • 7. The Goal Stable and reproducible environment for a Software. … environment for new developer, … test config changes, … clean package build env, … preconfigured demo box. But also quickly deployable, and centrally managed with current software versions.
  • 8. 1. Intro 2. Vagrant 3. Puppet Intro Dashboard & PE Facter & Hiera git Problems Misc
  • 9. Vagrant Configuration tool for VMs and Provisioning. “Local cloud” • Self service • Instant provisioning • Cost efficient • Elastic • Pay per use
  • 10. Vagrant VM Providers: • VirtualBox: “default”, works offline, ressource hungry • Docker: lightweight, requires Linux, good for testing • AWS EC2: remote VMs, good for automation (Jenkins) Provisioning: • Shell script • Puppet, apply manifest or run agent • Chef, solo or client • Ansible playbooks • Salt states • Docker containers
  • 11. VeeWee definition Veewee::Definition.declare({ :iso_file => "debian-wheezy-DI-b4-amd64-netinst.iso", :disk_size => '40560', :disk_format => 'VDI', :cpu_count => '2', :memory_size => '3192', :boot_wait => "10", :boot_cmd_sequence => [ '<Esc>', 'install ', 'preseed/url=http://%IP%:%PORT%/preseed.cfg ', 'debconf/frontend=noninteractive ', '<Enter>' ], :postinstall_files => [ "base.sh", "vagrant.sh", "customize-puppet.sh", ... ], ... })
  • 12. Vagrantfile Vagrant.configure("2") do |config| config.vm.box = "graylog2" config.vm.box_url = "http://vagrantboxes.footballradar.com/wheezy64.box" config.vm.provider "virtualbox" do |v| v.memory = 1024 end config.vm.provision :puppet do |puppet| puppet.manifest_file = "graylog2.pp" puppet.module_path = "modules" end config.vm.network :forwarded_port, guest: 9000, host: 9000 config.vm.network :forwarded_port, guest: 80, host: 8080 config.vm.network :forwarded_port, guest: 12201, host: 12201, protocol: 'udp' config.vm.network :forwarded_port, guest: 12201, host: 12201, protocol: 'tcp' config.vm.network :forwarded_port, guest: 12900, host: 12900 end
  • 13. Multi-VM Vagrantfile Vagrant.configure("2") do |config| # VM 1: appserver config.vm.define :app do |app| app.vm.hostname = "testbox.example.org" app.vm.network :forwarded_port, host: 8080, guest: 80 app.vm.synced_folder ".", "/home/vagrant/files" end # VM 2: DB server config.vm.define :db do |db| db.vm.hostname = "db.example.org" db.vm.provider :virtualbox do |vb| vb.customize ["modifyvm", :id, "--cpus", "2"] end end # Box & Provisioning config.vm.box = "precise64" config.vm.provision :shell, :path => "vagrant_install_puppet_keys.sh" config.vm.provision :puppet_server, :puppet_server => "puppetmaster.example.org" end
  • 14. vagrant-aws Vagrant.configure("2") do |config| config.vm.box = "dummy" config.vm.provider :aws do |aws, override| aws.access_key_id = "YOUR KEY" aws.secret_access_key = "YOUR SECRET KEY" aws.keypair_name = "KEYPAIR NAME" region = "eu-west-1" aws.ami = "ami-20414854" aws.tags = { 'Role' => 'TestVM', 'Net' => 'Devnet' } end end
  • 15. Synced Folders Shared folders, mounted from host into guest. Options: • VirtualBox • NFS • SMB • rsync
  • 16. Synced Folders src: Mitchell Hashimoto, Comparing Filesystem Performance in Virtual Machines
  • 17. 1. Intro 2. Vagrant 3. Puppet Intro Dashboard & PE Facter & Hiera git Problems Misc
  • 18. Puppet • Configuration Management • Declarative: Resources and Dependencies
  • 19. Puppet Puppet Agent execution: 1. Create catalog: • read manifest • gather resources • ensure order 2. Apply for each resource: • query state • change to desired state
  • 20. Syntax class vpn($version = 'present', $ca_crt, $usr_crt, $usr_key) { package { 'openvpn': ensure => $version; } file { "/etc/openvpn/client.key": ensure => file, mode => '0600', content => $usr_key; require => Package['openvpn'], notify => Service['openvpn']; "/etc/openvpn/client.conf": ensure => file, source => "puppet:///modules/vpn/client.conf", require => Package['openvpn'], notify => Service['openvpn']; } service { 'openvpn': ensure => running, require => Package['openvpn'], } }
  • 21. Syntax class vpn($version = 'present', $ca_crt, $usr_crt, $usr_key) { package { 'openvpn': ensure => $version; } -> file { "/etc/openvpn/client.key": ensure => file, mode => '0600', content => $usr_key; "/etc/openvpn/client.conf": ensure => file, source => "puppet:///modules/vpn/client.conf"; } ~> service { 'openvpn': ensure => running, } }
  • 23. Puppet Module Layout module_name • manifests Puppet code (classes/defines) - init.pp - subclass.pp • files static files • templates .erb templates • lib ruby plugins (custom types/facts) • tests usage examples for manifests • spec spec tests for libs
  • 26. stdlib facts.d • simple data input • e. g. ec2metadata, inventory lookup custom_facts.sh #! /bin/sh which ec2metadata >/dev/null 2>&1 || exit 1 echo "ec2_ami_id=$(ec2metadata --ami-id)" echo "ec2_instance_id=$(ec2metadata --instance-id)" echo "ec2_instance_type=$(ec2metadata --instance-type)" echo "ec2_public_ipv4=$(ec2metadata --public-ipv4)" echo "ec2_public_hostname=$(ec2metadata --public-hostname)"
  • 27. Hiera • banish top scope variables • use Hiera! • structure with roles & profiles
  • 28. node definitions vs. Hiera site.pp node "mydev.vagrantup.com" inherits basenode-vagrant { $vmEnv = "development" include sysadmin include ntp include vagrant include user::vagrant include mysqlserver include redisserver # ... }
  • 29. node definitions vs. Hiera site.pp hiera_include('include_classes', ['sysadmin']) node default { } role_elasticsearch.yaml include_classes: - elasticsearch - elasticsearch::plugins - zabbix::helper::elasticsearch elasticsearch::clustername: "mycluster" elasticsearch::client: false elasticsearch::heapsize: "768m"
  • 30. hiera.yaml :hierarchy: - node/%{fqdn} - vm/netenv_role_%{puppet_netenv}_%{puppet_role} - vm/role_%{puppet_role} - vm/netenv_%{puppet_netenv} - domain_%{domain} - common :backends: - yaml :logger: console :yaml: :datadir: "/etc/puppet/environments/%{environment}/"
  • 31. Example lookup fqdn = dev.pod1.org domain = pod1.org puppet_role = dev puppet_netenv = vagrant ⇒ Lookup in: 1. node/dev.pod1.org.yaml 2. vm/netenv_role_vagrant_dev.yaml 3. vm/role_dev.yaml 4. vm/netenv_vagrant.yaml 5. domain_pod1.org.yaml 6. common.yaml
  • 32. Hiera & Puppet 2.x compatibility class vpn($version = hiera('vpn::version', 'present'), $ca_crt = hiera('vpn::ca_crt'), $usr_crt = hiera('vpn::usr_crt'), $usr_key = hiera('vpn::usr_key')) { package { 'openvpn': ensure => $version; } # ... }
  • 33. git workflow • use git! • use git hooks • use per-user environments for easy testing • repos for testing/production
  • 34. git hook: Syntax Check Git pre-commit hook with puppet-lint to syntax check Puppet, ERB templates, YAML files (http://github.com/gini/puppet-git-hooks) Example Output: $ git commit -m 'test' modules/graylog2/templates/server.conf.erb -:5: syntax error, unexpected $undefined ...rd_sha2 = "; _erbout.concat(( @ root_pwd_sha2 ).to_s); _erbo... ... ^ ERB syntax error in modules/graylog2/templates/server.conf.erb
  • 35. git hook: E-Mail Notification Git post-receive hook to notify team on push (http://git.kernel.org/cgit/git/git.git/tree/contrib/hooks/ post-receive-email?id=HEAD) Example E-Mail: - Log ---------------------------------------------- commit 5df04ee883b8de8a37bf0ac97eec068cd1f3a414 Author: N. N. <n.n@deck36.de> Date: Tue Jan 7 08:57:17 2014 +0000 fixed path to csync2 executable ---------------------------------------------------- Summary of changes: modules/user/files/etc/sudoers.d/support | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
  • 36. environments • per user env + production ⇒ easy testing with puppet agent -t --environment=user • two servers for testing/production Config (in puppet < 3.5.0): puppet.conf [mschuette] modulepath = $confdir/environments/mschuette/modules manifest = $confdir/environments/mschuette/manifests/site.pp pluginsync = true
  • 38. Puppet Problems • some tasks require two agent runs • apt-get upgrade and package dependencies • beware of version mismatch between apt (or yum) and package • scoping and namespaces • exec is the new eval
  • 39. Version ping-pong modules/php/init.pp class php($version = '5.3.10-1ubuntu3.10') { package { 'php5-common': ensure => $version, } } class php::curl($version) { require php package { 'php5-curl': ensure => $version, } } server.pp class { 'php::curl': version => '5.5.5+dfsg-1+debphp.org~precise+2', }
  • 40. Namespace problems # this does not work, cf. #PUP-1073 package { 'memcached': ensure => present, provider => apt, } package { 'memcached': ensure => present, provider => gem, }
  • 41. exec tricks You can do (and break) everything with exec. But of course you should not.
  • 42. exec tricks # no pkg provider for npm exec { 'npm install -g less': creates => '/usr/lib/node_modules/npm/node_modules/less', } # hide change exec { 'zabbix_update.sh': command => 'false', onlyif => "/opt/zabbix_update.sh $api_url && false", logoutput => on_failure, }
  • 43. MCollective “multissh deluxe” AMQP client/server framework to • orchestrate actions • control puppet agents • run commands • query resources • …
  • 44. Hooks to other systems • include in provisioning process • provide normative data as facts • register or update DNS name → Route 53 • register or update host in Zabbix monitoring → API
  • 45. Versions • Puppet 2.7: legacy • Puppet 3.0: major upgrade, with Hiera support • Puppet 3.x: current development, future parser
  • 46. Questions? class presentation { package { 'questions': ensure => 'answered', } } Links: • Vagrant • Puppet Language: Visual Index • Puppet Type Reference • Puppet Ask