SlideShare uma empresa Scribd logo
1 de 40
Baixar para ler offline
What’s Puppet
Sysadmin en la onda DevOps
Drupal developer
10 años sysadmin
3 años con Puppet
8 años con Drupal
http://atlantic-canary.net
http://github.com/jonhattan
@_jonhattan_
Jonathan Araña Cruz (aka jonhattan)
Caballeros
What?
● Configuration management
● Written in Ruby
● Free software (Apache 2.0)
● Current version 3.6 - towards 4.0
● PuppetLabs, since 2005
● Other products
○ Puppet Enterprise
○ MCollective
Puppet CLI tool
root@chamber:~# puppet help
Usage: puppet <subcommand> [options] <action> [options]
…
root@chamber:~# puppet help <subcommand>
root@chamber:~# puppet man <subcommand>
=> man puppet-<subcommand>
Index
● Resource Abstraction Layer
● Puppet Language
● Modules
● Stored configuration
● Puppet Master
● Reporting
RAL: Resource types (I)
● Resource types: high-level models
○ Some types: package, service, file, user, cron,...
○ Providers: implementers on different systems
○ Providers for package: apt, yum, pip, gem, pear,...
● Available resource types
○ Puppet built-in reference: http://docs.puppetlabs.
com/references/latest/type.html
○ Cheatsheet: http://docs.puppetlabs.com/puppet_core_types_cheatsheet.pdf
○ Provided by 3rd party modules
root@chamber:~# puppet resource --types
anchor
augeas
computer
cron
database
database_grant
database_user
exec
file
file_line
filebucket
firewall
firewallchain
group
host
ini_setting
ini_subsetting
interface
k5login
macauthorization
mailalias
maillist
mcx
mount
mysql_database
mysql_grant
mysql_user
nagios_command
nagios_contact
nagios_contactgroup
nagios_host
nagios_hostdependency
network_config
network_route
notify
package
postgresql_conf
router
schedule
scheduled_task
selboolean
selmodule
service
ssh_authorized_key
sshkey
RAL: Resource types (II)
root@chamber:~# puppet describe -s user
Manage users. This type is mostly built to manage system
users, so it is lacking some features useful for managing normal
users.
Parameters
----------
ensure, expiry, gid, groups, home, keys, managehome, membership, name,
password, password_max_age, password_min_age, salt, shell,system, uid
Providers
---------
aix, directoryservice, hpuxuseradd, ldap, pw, user_role_add, useradd,
windows_adsi
RAL: Resource types (III)
RAL: Resources (I)
● Resource: instance of a resource type
○ Example: root user, ntp service, vim package,...
○ System discovery
○ Interactive management via CLI
○ Abstraction layer!
RAL: Resources (II)
root@chamber:~# puppet resource user --list
user { 'root':
ensure => 'present',
comment => 'root',
gid => '0',
home => '/root',
password => '$6$szUwrw3k.uAo.',
password_max_age => '99999',
password_min_age => '0',
shell => '/bin/bash',
uid => '0',
}
user { 'www-data':
ensure => 'present',
comment => 'www-data',
gid => '33',
home => '/var/www',
password => '*',
password_max_age => '99999',
password_min_age => '0',
shell => '/bin/sh',
uid => '33',
}
RAL: Resources (III)
root@chamber:~# puppet resource user root shell=/bin/dash
Notice: /User[root]/shell: shell changed '/bin/bash' to '/bin/dash'
user { 'root':
ensure => 'present',
shell => '/bin/dash',
}
root@chamber:~# puppet resource user root --edit
Index
● Resource Abstraction Layer
● => Puppet Language
● Modules
● Stored configuration
● Puppet Master
● Reporting
Puppet Language (I)
● Declarative, Domain Specific Language (DSL)
● Purpose of the language:
○ Describe desired state of the system by declaring
resources
○ Every other part of the language exists to add flexibility
and convenience to the way resources are declared
● Programs are called manifests
● A manifest is compiled into a catalog
Example manifest: Hello world
root@chamber:~# echo "notify {'hello world': }" > hello-world.pp
root@chamber:~# puppet apply hello-world.pp
Notice: Compiled catalog for chamber.faita.net in environment production in 0.02
seconds
Notice: hello world
Notice: /Stage[main]/Main/Notify[hello world]/message: defined 'message' as 'hello
world'
Notice: Finished catalog run in 3.15 seconds
Example manifest: “The trifecta”
case $operatingsystem {
centos, redhat: { $service_name = 'ntpd' }
debian, ubuntu: { $service_name = 'ntp' }
}
package { 'ntp':
ensure => installed,
}
service { 'ntp':
name => $service_name,
ensure => running,
enable => true,
subscribe => File['ntp.conf'],
}
file { '/etc/ntp.conf':
ensure => file,
require => Package['ntp'],
source => 'puppet:///modules/ntp/ntp.conf',
}
Puppet Language (II)
● Some language constructs
○ Nodes
○ Classes
○ Defines
○ Variables, Conditionals
○ Dependency relationships
○ Anchors, tags, collectors, run-stages,...
Nodes
● Block of code included in one node’s catalog
● ENC
● Ref: http://docs.puppetlabs.com/puppet/latest/reference/lang_node_definitions.html
# site.pp
node 'foo.example.com' {
...
}
node '/^(bar|baz).example.net$/' {
...
}
Classes (I)
● Block of code to group resources
● Parameterized
● Singleton
● Ref : http://docs.puppetlabs.com/puppet/latest/reference/lang_classes.html
Classes (II)
# file: ntp.pp
class ntp (
$ntpserver = ‘one.pool.ntp.org’,
) {
package { 'ntp':
…
}
service { 'ntp':
…
}
file {'/etc/ntp.conf':
…
}
}
# file: manifest.pp
import ntp.pp
# Include the class.
include ntp
# Alternatively this way you can override params
class {‘ntp’:
ntpserver => ‘other.pool.ntp.org’
}
# puppet apply manifest.pp
Defines (I)
● Blocks of code that can be evaluated multiple
times with different parameters
● Once defined, they act like a new
(compound) resource type
Defines (II)
define apache::vhost ($port, $docroot, $servername = $title, $vhost_name = '*') {
include apache # contains Package['httpd'] and Service['httpd']
include apache::params # contains common config settings
$vhost_dir = $apache::params::vhost_dir
file { "${vhost_dir}/${servername}.conf":
content => template('apache/vhost-default.conf.erb'),
owner => 'www',
group => 'www',
mode => '644',
require => Package['httpd'],
notify => Service['httpd'],
}
}
Puppet Language (III)
● Other related components
○ Functions
○ Facter
○ Hiera
● Language reference: http://docs.puppetlabs.
com/puppet/latest/reference/index.html
Functions
● Implemented in ruby
● Enrich puppet language with handy features
● Examples:
○ include
○ template()
● Built-in functions: http://docs.puppetlabs.com/references/latest/function.
html
● Puppet stdlib:https://github.com/puppetlabs/puppetlabs-stdlib
● Custom: http://docs.puppetlabs.com/guides/custom_functions.html
Facts
● System information, available as “global variables” in
manifests
root@chamber:~# facter
architecture => amd64
fqdn => chamber.faita.net
hostname => chamber
interfaces => eth0,lo
ipaddress => 10.0.0.2
ipaddress_eth0 => 10.0.0.2
ipaddress_lo => 127.0.0.1
is_virtual => true
kernel => Linux
kernelmajversion => 3.2
lsbdistcodename => wheezy
lsbdistid => Debian
lsbdistrelease => 7.5
lsbmajdistrelease => 7
osfamily => Debian
processor0 => Intel(R) Core(TM) i7-
3770 CPU @ 3.40GHz
processor1 => Intel(R) Core(TM) i7-
3770 CPU @ 3.40GHz
processorcount => 2
puppetversion => 3.6.0
virtual => xenu
Hiera (I)
● Key/value lookup tool for configuration data
● Hierarchical
● Avoid repetition
○ Write common data for most nodes
○ Override some values for nodes with a specific role
○ Override some of those values for one or two unique
nodes
● Ref: http://docs.puppetlabs.com/hiera/1/
Hiera (II)
# file /etc/hiera.yaml
---
:backends:
- yaml
:yaml:
:datadir: /etc/puppet/hiera
:hierarchy:
- "os/%{lsbdistid}"
- "groups/%{::domain}"
- "node/%{::fqdn}"
- common
# Files in /etc/puppet/hiera/
os/RedHat.yaml
os/Debian.yaml
groups/example.net.yaml
groups/example.com.yaml
hiera/nodes/bar.example.com.yaml
hiera/nodes/baz.example.net.yaml
hiera/nodes/foo.example.com.yaml
Hiera (III)
# os/RedHat.yaml
packages:
- httpd
# os/Debian.yaml
packages:
- apache2
# nodes/foo.example.com.yaml
packages:
- apache2-mpm-itk
Index
● Resource Abstraction Layer
● Puppet Language
● => Modules
● Stored configuration
● Puppet Master
● Reporting
Modules (I)
● Self-contained bundles of code and data
● Manifests, classes, defines, files, templates,
functions, tests,...
● Directory tree: MODULENAME/manifests/
MODULENAME/files/
MODULENAME/templates/
MODULENAME/lib/
MODULENAME/facts.d/
MODULENAME/tests/
MODULENAME/spec/
Modules (II)
● Best practices / well-known patterns
● Ref: http://docs.puppetlabs.com/puppet/latest/reference/modules_fundamentals.html
● Puppet forge: https://forge.puppetlabs.com
● CLI subcommand: puppet module install puppetlabs/mysql
● Librarian: https://github.com/rodjek/librarian-puppet
Index
● Resource Abstraction Layer
● Puppet Language
● Modules
● => Stored configuration
● Puppet Master
● Reporting
Stored configuration
● Centralized store of puppet-produced data
○ Nodes, resources, relationships, facts
○ Catalog run log
● Exported resources
● Inventory service: http://docs.puppetlabs.com/guides/inventory_service.
html
● Active Record (sql backends)
● PuppetDB: http://docs.puppetlabs.com/puppetdb/2.0/index.html
Index
● Resource Abstraction Layer
● Puppet Language
● Modules
● Stored configuration
● => Puppet Master
● Reporting
Puppet Master
● Pull-based agent/master mode
● REST API
● Master stores manifests
● Agent requests its catalog to the master
● Ref: http://docs.puppetlabs.com/learning/agent_master_basic.html
Standalone (puppet apply site.pp)
Index
● Resource Abstraction Layer
● Puppet Language
● Modules
● Nodes, ENC
● Store configs, PuppetDB
● Puppet Master
● => Reporting
Reporting (I)
● Agent send reports at the end of every run
○ Logs
○ Metrics: time, resources, changes
● Report handlers: http, log, tagmail
● Ref: http://docs.puppetlabs.com/references/latest/report.html
● Puppet Dashboard: web interface
○ web interface: node classification and reporting
feature
○ Ref: https://github.com/sodabrew/puppet-dashboard
Reporting (II)
Questions?

Mais conteúdo relacionado

Mais procurados

Puppet for SysAdmins
Puppet for SysAdminsPuppet for SysAdmins
Puppet for SysAdminsPuppet
 
Replacing "exec" with a type and provider: Return manifests to a declarative ...
Replacing "exec" with a type and provider: Return manifests to a declarative ...Replacing "exec" with a type and provider: Return manifests to a declarative ...
Replacing "exec" with a type and provider: Return manifests to a declarative ...Puppet
 
Can you upgrade to Puppet 4.x?
Can you upgrade to Puppet 4.x?Can you upgrade to Puppet 4.x?
Can you upgrade to Puppet 4.x?Martin Alfke
 
DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)Soshi Nemoto
 
Ansible not only for Dummies
Ansible not only for DummiesAnsible not only for Dummies
Ansible not only for DummiesŁukasz Proszek
 
Introduction to Puppet Scripting
Introduction to Puppet ScriptingIntroduction to Puppet Scripting
Introduction to Puppet ScriptingAchieve Internet
 
Configuration Surgery with Augeas
Configuration Surgery with AugeasConfiguration Surgery with Augeas
Configuration Surgery with AugeasPuppet
 
Cloud meets Fog & Puppet A Story of Version Controlled Infrastructure
Cloud meets Fog & Puppet A Story of Version Controlled InfrastructureCloud meets Fog & Puppet A Story of Version Controlled Infrastructure
Cloud meets Fog & Puppet A Story of Version Controlled InfrastructureHabeeb Rahman
 
Puppet modules: An Holistic Approach
Puppet modules: An Holistic ApproachPuppet modules: An Holistic Approach
Puppet modules: An Holistic ApproachAlessandro Franceschi
 
Getting started with Ansible
Getting started with AnsibleGetting started with Ansible
Getting started with AnsibleIvan Serdyuk
 
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & HadoopPuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & HadoopWalter Heck
 
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
 
Essential applications management with Tiny Puppet
Essential applications management with Tiny PuppetEssential applications management with Tiny Puppet
Essential applications management with Tiny PuppetAlessandro Franceschi
 

Mais procurados (20)

Puppet for SysAdmins
Puppet for SysAdminsPuppet for SysAdmins
Puppet for SysAdmins
 
Puppet - an introduction
Puppet - an introductionPuppet - an introduction
Puppet - an introduction
 
Puppet: From 0 to 100 in 30 minutes
Puppet: From 0 to 100 in 30 minutesPuppet: From 0 to 100 in 30 minutes
Puppet: From 0 to 100 in 30 minutes
 
Replacing "exec" with a type and provider: Return manifests to a declarative ...
Replacing "exec" with a type and provider: Return manifests to a declarative ...Replacing "exec" with a type and provider: Return manifests to a declarative ...
Replacing "exec" with a type and provider: Return manifests to a declarative ...
 
Can you upgrade to Puppet 4.x?
Can you upgrade to Puppet 4.x?Can you upgrade to Puppet 4.x?
Can you upgrade to Puppet 4.x?
 
DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)
 
Puppet @ Seat
Puppet @ SeatPuppet @ Seat
Puppet @ Seat
 
Puppet modules for Fun and Profit
Puppet modules for Fun and ProfitPuppet modules for Fun and Profit
Puppet modules for Fun and Profit
 
Ansible not only for Dummies
Ansible not only for DummiesAnsible not only for Dummies
Ansible not only for Dummies
 
Introduction to Puppet Scripting
Introduction to Puppet ScriptingIntroduction to Puppet Scripting
Introduction to Puppet Scripting
 
Configuration Surgery with Augeas
Configuration Surgery with AugeasConfiguration Surgery with Augeas
Configuration Surgery with Augeas
 
Cloud meets Fog & Puppet A Story of Version Controlled Infrastructure
Cloud meets Fog & Puppet A Story of Version Controlled InfrastructureCloud meets Fog & Puppet A Story of Version Controlled Infrastructure
Cloud meets Fog & Puppet A Story of Version Controlled Infrastructure
 
Puppet modules: An Holistic Approach
Puppet modules: An Holistic ApproachPuppet modules: An Holistic Approach
Puppet modules: An Holistic Approach
 
Anatomy of a reusable module
Anatomy of a reusable moduleAnatomy of a reusable module
Anatomy of a reusable module
 
Getting started with Ansible
Getting started with AnsibleGetting started with Ansible
Getting started with Ansible
 
Puppet fundamentals
Puppet fundamentalsPuppet fundamentals
Puppet fundamentals
 
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & HadoopPuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
 
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.
 
Essential applications management with Tiny Puppet
Essential applications management with Tiny PuppetEssential applications management with Tiny Puppet
Essential applications management with Tiny Puppet
 
Puppet_training
Puppet_trainingPuppet_training
Puppet_training
 

Destaque

Using Puppet with Self Service Provisioning
Using Puppet with Self Service ProvisioningUsing Puppet with Self Service Provisioning
Using Puppet with Self Service ProvisioningPuppet
 
Building self-service on demand infrastructure with Puppet and VMware
Building self-service on demand infrastructure with Puppet and VMwareBuilding self-service on demand infrastructure with Puppet and VMware
Building self-service on demand infrastructure with Puppet and VMwarePuppet
 
Design Summit - UI Roadmap - Dan Clarizio, Martin Povolny
Design Summit - UI Roadmap - Dan Clarizio, Martin PovolnyDesign Summit - UI Roadmap - Dan Clarizio, Martin Povolny
Design Summit - UI Roadmap - Dan Clarizio, Martin PovolnyManageIQ
 
Samsung presentation
Samsung presentationSamsung presentation
Samsung presentationMohd Tayyab
 
Sebastien goasguen cloud stack and docker
Sebastien goasguen   cloud stack and dockerSebastien goasguen   cloud stack and docker
Sebastien goasguen cloud stack and dockerShapeBlue
 
Satellite 6 - Pupet Introduction
Satellite 6 - Pupet IntroductionSatellite 6 - Pupet Introduction
Satellite 6 - Pupet IntroductionMichael Lessard
 
OpenCloudConf: It takes an (Open Source) Village to Build a Cloud
OpenCloudConf: It takes an (Open Source) Village to Build a CloudOpenCloudConf: It takes an (Open Source) Village to Build a Cloud
OpenCloudConf: It takes an (Open Source) Village to Build a CloudMark Hinkle
 
Puppet - The IT automation software
Puppet - The IT automation softwarePuppet - The IT automation software
Puppet - The IT automation softwareagenedy
 
Apache CXF New Directions in Integration
Apache CXF New Directions in IntegrationApache CXF New Directions in Integration
Apache CXF New Directions in IntegrationDaniel Kulp
 
OpenNMS Reporting - Enhancement
OpenNMS Reporting - EnhancementOpenNMS Reporting - Enhancement
OpenNMS Reporting - EnhancementRonny
 
OpenStack and CloudForms Do's and Dont's
OpenStack and CloudForms Do's and Dont'sOpenStack and CloudForms Do's and Dont's
OpenStack and CloudForms Do's and Dont'sFrederik Bijlsma
 
DevOps, A path to Enterprises to Adopt [Decoding DevOps Conference - InfoSep...
DevOps, A path to Enterprises to Adopt  [Decoding DevOps Conference - InfoSep...DevOps, A path to Enterprises to Adopt  [Decoding DevOps Conference - InfoSep...
DevOps, A path to Enterprises to Adopt [Decoding DevOps Conference - InfoSep...InfoSeption
 
Replication - Nick Carboni - ManageIQ Design Summit 2016
Replication - Nick Carboni - ManageIQ Design Summit 2016Replication - Nick Carboni - ManageIQ Design Summit 2016
Replication - Nick Carboni - ManageIQ Design Summit 2016ManageIQ
 
Managed Services - Mike Hulsman - ManageIQ Design Summit 2016
Managed Services - Mike Hulsman - ManageIQ Design Summit 2016Managed Services - Mike Hulsman - ManageIQ Design Summit 2016
Managed Services - Mike Hulsman - ManageIQ Design Summit 2016ManageIQ
 
OpenStack Hybrid Cloud Management and Orchestration - James Bond
OpenStack Hybrid Cloud Management and Orchestration - James BondOpenStack Hybrid Cloud Management and Orchestration - James Bond
OpenStack Hybrid Cloud Management and Orchestration - James Bondscoopnewsgroup
 
Introduction to OpenNMS
Introduction to OpenNMSIntroduction to OpenNMS
Introduction to OpenNMSPOSSCON
 
Building Enterprise Clouds - Key Considerations and Strategies - RED HAT
Building Enterprise Clouds - Key Considerations and Strategies - RED HATBuilding Enterprise Clouds - Key Considerations and Strategies - RED HAT
Building Enterprise Clouds - Key Considerations and Strategies - RED HATFadi Semaan
 

Destaque (20)

Using Puppet with Self Service Provisioning
Using Puppet with Self Service ProvisioningUsing Puppet with Self Service Provisioning
Using Puppet with Self Service Provisioning
 
Infrastructure as Code with Chef / Puppet
Infrastructure as Code with Chef / PuppetInfrastructure as Code with Chef / Puppet
Infrastructure as Code with Chef / Puppet
 
Las palmas devops: Pruebas de carga web
Las palmas devops: Pruebas de carga webLas palmas devops: Pruebas de carga web
Las palmas devops: Pruebas de carga web
 
SCM PPT
SCM PPTSCM PPT
SCM PPT
 
Building self-service on demand infrastructure with Puppet and VMware
Building self-service on demand infrastructure with Puppet and VMwareBuilding self-service on demand infrastructure with Puppet and VMware
Building self-service on demand infrastructure with Puppet and VMware
 
Design Summit - UI Roadmap - Dan Clarizio, Martin Povolny
Design Summit - UI Roadmap - Dan Clarizio, Martin PovolnyDesign Summit - UI Roadmap - Dan Clarizio, Martin Povolny
Design Summit - UI Roadmap - Dan Clarizio, Martin Povolny
 
Samsung presentation
Samsung presentationSamsung presentation
Samsung presentation
 
Sebastien goasguen cloud stack and docker
Sebastien goasguen   cloud stack and dockerSebastien goasguen   cloud stack and docker
Sebastien goasguen cloud stack and docker
 
Satellite 6 - Pupet Introduction
Satellite 6 - Pupet IntroductionSatellite 6 - Pupet Introduction
Satellite 6 - Pupet Introduction
 
OpenCloudConf: It takes an (Open Source) Village to Build a Cloud
OpenCloudConf: It takes an (Open Source) Village to Build a CloudOpenCloudConf: It takes an (Open Source) Village to Build a Cloud
OpenCloudConf: It takes an (Open Source) Village to Build a Cloud
 
Puppet - The IT automation software
Puppet - The IT automation softwarePuppet - The IT automation software
Puppet - The IT automation software
 
Apache CXF New Directions in Integration
Apache CXF New Directions in IntegrationApache CXF New Directions in Integration
Apache CXF New Directions in Integration
 
OpenNMS Reporting - Enhancement
OpenNMS Reporting - EnhancementOpenNMS Reporting - Enhancement
OpenNMS Reporting - Enhancement
 
OpenStack and CloudForms Do's and Dont's
OpenStack and CloudForms Do's and Dont'sOpenStack and CloudForms Do's and Dont's
OpenStack and CloudForms Do's and Dont's
 
DevOps, A path to Enterprises to Adopt [Decoding DevOps Conference - InfoSep...
DevOps, A path to Enterprises to Adopt  [Decoding DevOps Conference - InfoSep...DevOps, A path to Enterprises to Adopt  [Decoding DevOps Conference - InfoSep...
DevOps, A path to Enterprises to Adopt [Decoding DevOps Conference - InfoSep...
 
Replication - Nick Carboni - ManageIQ Design Summit 2016
Replication - Nick Carboni - ManageIQ Design Summit 2016Replication - Nick Carboni - ManageIQ Design Summit 2016
Replication - Nick Carboni - ManageIQ Design Summit 2016
 
Managed Services - Mike Hulsman - ManageIQ Design Summit 2016
Managed Services - Mike Hulsman - ManageIQ Design Summit 2016Managed Services - Mike Hulsman - ManageIQ Design Summit 2016
Managed Services - Mike Hulsman - ManageIQ Design Summit 2016
 
OpenStack Hybrid Cloud Management and Orchestration - James Bond
OpenStack Hybrid Cloud Management and Orchestration - James BondOpenStack Hybrid Cloud Management and Orchestration - James Bond
OpenStack Hybrid Cloud Management and Orchestration - James Bond
 
Introduction to OpenNMS
Introduction to OpenNMSIntroduction to OpenNMS
Introduction to OpenNMS
 
Building Enterprise Clouds - Key Considerations and Strategies - RED HAT
Building Enterprise Clouds - Key Considerations and Strategies - RED HATBuilding Enterprise Clouds - Key Considerations and Strategies - RED HAT
Building Enterprise Clouds - Key Considerations and Strategies - RED HAT
 

Semelhante a Intro to-puppet

Learning Puppet basic thing
Learning Puppet basic thing Learning Puppet basic thing
Learning Puppet basic thing DaeHyung Lee
 
The beautyandthebeast phpbat2010
The beautyandthebeast phpbat2010The beautyandthebeast phpbat2010
The beautyandthebeast phpbat2010Bastian Feder
 
Introduction to ansible
Introduction to ansibleIntroduction to ansible
Introduction to ansibleOmid Vahdaty
 
#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to Ansible#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to AnsibleCédric Delgehier
 
Puppet overview
Puppet overviewPuppet overview
Puppet overviewMike_Foto
 
Improving Operations Efficiency with Puppet
Improving Operations Efficiency with PuppetImproving Operations Efficiency with Puppet
Improving Operations Efficiency with PuppetNicolas Brousse
 
Puppet HackDay/BarCamp New Delhi Exercises
Puppet HackDay/BarCamp New Delhi ExercisesPuppet HackDay/BarCamp New Delhi Exercises
Puppet HackDay/BarCamp New Delhi ExercisesJulie Tsai
 
The Beauty And The Beast Php N W09
The Beauty And The Beast Php N W09The Beauty And The Beast Php N W09
The Beauty And The Beast Php N W09Bastian Feder
 
Orchestrated Functional Testing with Puppet-spec and Mspectator
Orchestrated Functional Testing with Puppet-spec and MspectatorOrchestrated Functional Testing with Puppet-spec and Mspectator
Orchestrated Functional Testing with Puppet-spec and MspectatorRaphaël PINSON
 
Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...
Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...
Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...Puppet
 
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdfHashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdfssuser705051
 
Hadoop meet Rex(How to construct hadoop cluster with rex)
Hadoop meet Rex(How to construct hadoop cluster with rex)Hadoop meet Rex(How to construct hadoop cluster with rex)
Hadoop meet Rex(How to construct hadoop cluster with rex)Jun Hong Kim
 
Ansible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife OrchestrationAnsible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife Orchestrationbcoca
 
Workflow story: Theory versus Practice in large enterprises by Marcin Piebiak
Workflow story: Theory versus Practice in large enterprises by Marcin PiebiakWorkflow story: Theory versus Practice in large enterprises by Marcin Piebiak
Workflow story: Theory versus Practice in large enterprises by Marcin PiebiakNETWAYS
 
Workflow story: Theory versus practice in Large Enterprises
Workflow story: Theory versus practice in Large EnterprisesWorkflow story: Theory versus practice in Large Enterprises
Workflow story: Theory versus practice in Large EnterprisesPuppet
 
Devops for beginners
Devops for beginnersDevops for beginners
Devops for beginnersVivek Parihar
 
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
 

Semelhante a Intro to-puppet (20)

Learning Puppet basic thing
Learning Puppet basic thing Learning Puppet basic thing
Learning Puppet basic thing
 
The beautyandthebeast phpbat2010
The beautyandthebeast phpbat2010The beautyandthebeast phpbat2010
The beautyandthebeast phpbat2010
 
Installing AtoM with Ansible
Installing AtoM with AnsibleInstalling AtoM with Ansible
Installing AtoM with Ansible
 
Introduction to ansible
Introduction to ansibleIntroduction to ansible
Introduction to ansible
 
#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to Ansible#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to Ansible
 
Puppet overview
Puppet overviewPuppet overview
Puppet overview
 
Improving Operations Efficiency with Puppet
Improving Operations Efficiency with PuppetImproving Operations Efficiency with Puppet
Improving Operations Efficiency with Puppet
 
Puppet HackDay/BarCamp New Delhi Exercises
Puppet HackDay/BarCamp New Delhi ExercisesPuppet HackDay/BarCamp New Delhi Exercises
Puppet HackDay/BarCamp New Delhi Exercises
 
The Beauty And The Beast Php N W09
The Beauty And The Beast Php N W09The Beauty And The Beast Php N W09
The Beauty And The Beast Php N W09
 
Orchestrated Functional Testing with Puppet-spec and Mspectator
Orchestrated Functional Testing with Puppet-spec and MspectatorOrchestrated Functional Testing with Puppet-spec and Mspectator
Orchestrated Functional Testing with Puppet-spec and Mspectator
 
Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...
Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...
Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...
 
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdfHashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
 
Terraform-2.pdf
Terraform-2.pdfTerraform-2.pdf
Terraform-2.pdf
 
Hadoop meet Rex(How to construct hadoop cluster with rex)
Hadoop meet Rex(How to construct hadoop cluster with rex)Hadoop meet Rex(How to construct hadoop cluster with rex)
Hadoop meet Rex(How to construct hadoop cluster with rex)
 
Ansible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife OrchestrationAnsible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife Orchestration
 
Ansible - Introduction
Ansible - IntroductionAnsible - Introduction
Ansible - Introduction
 
Workflow story: Theory versus Practice in large enterprises by Marcin Piebiak
Workflow story: Theory versus Practice in large enterprises by Marcin PiebiakWorkflow story: Theory versus Practice in large enterprises by Marcin Piebiak
Workflow story: Theory versus Practice in large enterprises by Marcin Piebiak
 
Workflow story: Theory versus practice in Large Enterprises
Workflow story: Theory versus practice in Large EnterprisesWorkflow story: Theory versus practice in Large Enterprises
Workflow story: Theory versus practice in Large Enterprises
 
Devops for beginners
Devops for beginnersDevops for beginners
Devops for beginners
 
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
 

Último

Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfproinshot.com
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfryanfarris8
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 

Último (20)

Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 

Intro to-puppet

  • 2. Sysadmin en la onda DevOps Drupal developer 10 años sysadmin 3 años con Puppet 8 años con Drupal http://atlantic-canary.net http://github.com/jonhattan @_jonhattan_ Jonathan Araña Cruz (aka jonhattan)
  • 4. What? ● Configuration management ● Written in Ruby ● Free software (Apache 2.0) ● Current version 3.6 - towards 4.0 ● PuppetLabs, since 2005 ● Other products ○ Puppet Enterprise ○ MCollective
  • 5. Puppet CLI tool root@chamber:~# puppet help Usage: puppet <subcommand> [options] <action> [options] … root@chamber:~# puppet help <subcommand> root@chamber:~# puppet man <subcommand> => man puppet-<subcommand>
  • 6. Index ● Resource Abstraction Layer ● Puppet Language ● Modules ● Stored configuration ● Puppet Master ● Reporting
  • 7. RAL: Resource types (I) ● Resource types: high-level models ○ Some types: package, service, file, user, cron,... ○ Providers: implementers on different systems ○ Providers for package: apt, yum, pip, gem, pear,... ● Available resource types ○ Puppet built-in reference: http://docs.puppetlabs. com/references/latest/type.html ○ Cheatsheet: http://docs.puppetlabs.com/puppet_core_types_cheatsheet.pdf ○ Provided by 3rd party modules
  • 8. root@chamber:~# puppet resource --types anchor augeas computer cron database database_grant database_user exec file file_line filebucket firewall firewallchain group host ini_setting ini_subsetting interface k5login macauthorization mailalias maillist mcx mount mysql_database mysql_grant mysql_user nagios_command nagios_contact nagios_contactgroup nagios_host nagios_hostdependency network_config network_route notify package postgresql_conf router schedule scheduled_task selboolean selmodule service ssh_authorized_key sshkey RAL: Resource types (II)
  • 9. root@chamber:~# puppet describe -s user Manage users. This type is mostly built to manage system users, so it is lacking some features useful for managing normal users. Parameters ---------- ensure, expiry, gid, groups, home, keys, managehome, membership, name, password, password_max_age, password_min_age, salt, shell,system, uid Providers --------- aix, directoryservice, hpuxuseradd, ldap, pw, user_role_add, useradd, windows_adsi RAL: Resource types (III)
  • 10. RAL: Resources (I) ● Resource: instance of a resource type ○ Example: root user, ntp service, vim package,... ○ System discovery ○ Interactive management via CLI ○ Abstraction layer!
  • 11. RAL: Resources (II) root@chamber:~# puppet resource user --list user { 'root': ensure => 'present', comment => 'root', gid => '0', home => '/root', password => '$6$szUwrw3k.uAo.', password_max_age => '99999', password_min_age => '0', shell => '/bin/bash', uid => '0', } user { 'www-data': ensure => 'present', comment => 'www-data', gid => '33', home => '/var/www', password => '*', password_max_age => '99999', password_min_age => '0', shell => '/bin/sh', uid => '33', }
  • 12. RAL: Resources (III) root@chamber:~# puppet resource user root shell=/bin/dash Notice: /User[root]/shell: shell changed '/bin/bash' to '/bin/dash' user { 'root': ensure => 'present', shell => '/bin/dash', } root@chamber:~# puppet resource user root --edit
  • 13. Index ● Resource Abstraction Layer ● => Puppet Language ● Modules ● Stored configuration ● Puppet Master ● Reporting
  • 14. Puppet Language (I) ● Declarative, Domain Specific Language (DSL) ● Purpose of the language: ○ Describe desired state of the system by declaring resources ○ Every other part of the language exists to add flexibility and convenience to the way resources are declared ● Programs are called manifests ● A manifest is compiled into a catalog
  • 15. Example manifest: Hello world root@chamber:~# echo "notify {'hello world': }" > hello-world.pp root@chamber:~# puppet apply hello-world.pp Notice: Compiled catalog for chamber.faita.net in environment production in 0.02 seconds Notice: hello world Notice: /Stage[main]/Main/Notify[hello world]/message: defined 'message' as 'hello world' Notice: Finished catalog run in 3.15 seconds
  • 16. Example manifest: “The trifecta” case $operatingsystem { centos, redhat: { $service_name = 'ntpd' } debian, ubuntu: { $service_name = 'ntp' } } package { 'ntp': ensure => installed, } service { 'ntp': name => $service_name, ensure => running, enable => true, subscribe => File['ntp.conf'], } file { '/etc/ntp.conf': ensure => file, require => Package['ntp'], source => 'puppet:///modules/ntp/ntp.conf', }
  • 17. Puppet Language (II) ● Some language constructs ○ Nodes ○ Classes ○ Defines ○ Variables, Conditionals ○ Dependency relationships ○ Anchors, tags, collectors, run-stages,...
  • 18. Nodes ● Block of code included in one node’s catalog ● ENC ● Ref: http://docs.puppetlabs.com/puppet/latest/reference/lang_node_definitions.html # site.pp node 'foo.example.com' { ... } node '/^(bar|baz).example.net$/' { ... }
  • 19. Classes (I) ● Block of code to group resources ● Parameterized ● Singleton ● Ref : http://docs.puppetlabs.com/puppet/latest/reference/lang_classes.html
  • 20. Classes (II) # file: ntp.pp class ntp ( $ntpserver = ‘one.pool.ntp.org’, ) { package { 'ntp': … } service { 'ntp': … } file {'/etc/ntp.conf': … } } # file: manifest.pp import ntp.pp # Include the class. include ntp # Alternatively this way you can override params class {‘ntp’: ntpserver => ‘other.pool.ntp.org’ } # puppet apply manifest.pp
  • 21. Defines (I) ● Blocks of code that can be evaluated multiple times with different parameters ● Once defined, they act like a new (compound) resource type
  • 22. Defines (II) define apache::vhost ($port, $docroot, $servername = $title, $vhost_name = '*') { include apache # contains Package['httpd'] and Service['httpd'] include apache::params # contains common config settings $vhost_dir = $apache::params::vhost_dir file { "${vhost_dir}/${servername}.conf": content => template('apache/vhost-default.conf.erb'), owner => 'www', group => 'www', mode => '644', require => Package['httpd'], notify => Service['httpd'], } }
  • 23. Puppet Language (III) ● Other related components ○ Functions ○ Facter ○ Hiera ● Language reference: http://docs.puppetlabs. com/puppet/latest/reference/index.html
  • 24. Functions ● Implemented in ruby ● Enrich puppet language with handy features ● Examples: ○ include ○ template() ● Built-in functions: http://docs.puppetlabs.com/references/latest/function. html ● Puppet stdlib:https://github.com/puppetlabs/puppetlabs-stdlib ● Custom: http://docs.puppetlabs.com/guides/custom_functions.html
  • 25. Facts ● System information, available as “global variables” in manifests root@chamber:~# facter architecture => amd64 fqdn => chamber.faita.net hostname => chamber interfaces => eth0,lo ipaddress => 10.0.0.2 ipaddress_eth0 => 10.0.0.2 ipaddress_lo => 127.0.0.1 is_virtual => true kernel => Linux kernelmajversion => 3.2 lsbdistcodename => wheezy lsbdistid => Debian lsbdistrelease => 7.5 lsbmajdistrelease => 7 osfamily => Debian processor0 => Intel(R) Core(TM) i7- 3770 CPU @ 3.40GHz processor1 => Intel(R) Core(TM) i7- 3770 CPU @ 3.40GHz processorcount => 2 puppetversion => 3.6.0 virtual => xenu
  • 26. Hiera (I) ● Key/value lookup tool for configuration data ● Hierarchical ● Avoid repetition ○ Write common data for most nodes ○ Override some values for nodes with a specific role ○ Override some of those values for one or two unique nodes ● Ref: http://docs.puppetlabs.com/hiera/1/
  • 27. Hiera (II) # file /etc/hiera.yaml --- :backends: - yaml :yaml: :datadir: /etc/puppet/hiera :hierarchy: - "os/%{lsbdistid}" - "groups/%{::domain}" - "node/%{::fqdn}" - common # Files in /etc/puppet/hiera/ os/RedHat.yaml os/Debian.yaml groups/example.net.yaml groups/example.com.yaml hiera/nodes/bar.example.com.yaml hiera/nodes/baz.example.net.yaml hiera/nodes/foo.example.com.yaml
  • 28. Hiera (III) # os/RedHat.yaml packages: - httpd # os/Debian.yaml packages: - apache2 # nodes/foo.example.com.yaml packages: - apache2-mpm-itk
  • 29. Index ● Resource Abstraction Layer ● Puppet Language ● => Modules ● Stored configuration ● Puppet Master ● Reporting
  • 30. Modules (I) ● Self-contained bundles of code and data ● Manifests, classes, defines, files, templates, functions, tests,... ● Directory tree: MODULENAME/manifests/ MODULENAME/files/ MODULENAME/templates/ MODULENAME/lib/ MODULENAME/facts.d/ MODULENAME/tests/ MODULENAME/spec/
  • 31. Modules (II) ● Best practices / well-known patterns ● Ref: http://docs.puppetlabs.com/puppet/latest/reference/modules_fundamentals.html ● Puppet forge: https://forge.puppetlabs.com ● CLI subcommand: puppet module install puppetlabs/mysql ● Librarian: https://github.com/rodjek/librarian-puppet
  • 32. Index ● Resource Abstraction Layer ● Puppet Language ● Modules ● => Stored configuration ● Puppet Master ● Reporting
  • 33. Stored configuration ● Centralized store of puppet-produced data ○ Nodes, resources, relationships, facts ○ Catalog run log ● Exported resources ● Inventory service: http://docs.puppetlabs.com/guides/inventory_service. html ● Active Record (sql backends) ● PuppetDB: http://docs.puppetlabs.com/puppetdb/2.0/index.html
  • 34. Index ● Resource Abstraction Layer ● Puppet Language ● Modules ● Stored configuration ● => Puppet Master ● Reporting
  • 35. Puppet Master ● Pull-based agent/master mode ● REST API ● Master stores manifests ● Agent requests its catalog to the master ● Ref: http://docs.puppetlabs.com/learning/agent_master_basic.html
  • 37. Index ● Resource Abstraction Layer ● Puppet Language ● Modules ● Nodes, ENC ● Store configs, PuppetDB ● Puppet Master ● => Reporting
  • 38. Reporting (I) ● Agent send reports at the end of every run ○ Logs ○ Metrics: time, resources, changes ● Report handlers: http, log, tagmail ● Ref: http://docs.puppetlabs.com/references/latest/report.html ● Puppet Dashboard: web interface ○ web interface: node classification and reporting feature ○ Ref: https://github.com/sodabrew/puppet-dashboard