SlideShare uma empresa Scribd logo
1 de 33
Baixar para ler offline
PuppetCamp Europe 2011
 27/28 April Amsterdam
What’s Puppi?


A Puppet Module
A Bash Command
A tool to automate deployments
A SysAdmin friend
puppi
puppi
Usage: puppi <command> [project|topic] [options]

Available commands:
check [project] - Run puppi checks host-wide or for project
log [topic] [-i] - Show system and application specific logs
info [topic] [-i] - Show informations about the system
init <project> - First time project initialization and setup
deploy <project> - Deploy the specified project
rollback <project> - Rollback the specified project.

Available options:
-f - Force puppi commands execution flow also on CRITICAL errors
-i - Interactively ask confirmation for every step
-t - Test mode. Just show the commands that should be executed
-d <yes|full> - Debug mode. Show debug of what is done.
-o "parameter=value parameter2=value2" - Set manual options to override defaults

Available projects:
abnormalia.net   git.example42.com  openskills.info openskills.info_sql
www.example42.com www.example42.com_sql   www.lab42.it

Available info topics:
apache! disks hardware mcollective munin     mysql   network   nrpe   ntp! openssh
packages perf postfix puppi rsync! users

Available log topics:
abnormalia.net! auth git.example42.com mail mcollective munin         mysql
openskills.info rsync system www.example42.com www.lab42.it
puppi check



Instant
systems
health check
puppi check
# Run all local checks
puppi check

# Run checks related to myapp
puppi check myapp

#   Checks can be on:
#   - Running services
#   - Listening ports
#   - Pattern match on specific URLs
#   - General system’s status
#   - Remote services used by the host
#
#   - Whatever a Nagios plugin can check
puppi check
# Each check is a Puppet define

puppi::check   { "NTP_Sync":
    command    => "check_ntp -H ${puppi::params::ntp_server}" ,
    priority   => "20" ,
    hostwide   => "yes" ,
}

puppi::check { "Port_exim_$port":
    command => "check_tcp -H ${fqdn} -p ${exim::params::port}" ,
}

puppi::check { "Url_$name":
    enable   => $enable,
    hostwide => no,
    project => “myapp”,
    command => "check_http -I '${target}' -p '${port}' -u '$
{url}' -s '${pattern}'" ,
}
puppi info


Quick
and focused
info from the
system
puppi info
# Show all the info available
puppi info

# Interactive. Select the topics to show
puppi info -i

# Check local resources
puppi info network
puppi info perf

# Module based info sources
puppi info openssh
puppi info apache

# Company and node specific info
puppi info mycompany
puppi info
puppi::info { "network":
    description => "Network settings and stats" ,
    run         => [ "ifconfig”,“route”,“cat /etc resolv.conf”,
                     “netstat -natup|grep LISTEN" ],
}

puppi::info::module { "openssh":
    packagename => "${openssh::params::packagename}",
    servicename => "${openssh::params::servicename}",
    processname => "${openssh::params::processname}",
    configfile => "${openssh::params::configfile}",
    datadir     => "${openssh::params::datadir}",
    logdir      => "${openssh::params::logdir}",
    protocol    => "${openssh::params::protocol}",
    port        => "${openssh::params::port}",
    description => "What Puppet knows about openssh" ,
    run         => "ls -la ~/.ssh/",
}

puppi::info::readme { "mycompany": }
puppi log



All logs
in a single
command
puppi log
# tail -f of all the known logs
puppi log

# Interactive. CHoose logs to show
puppi log -i

# Tail of logs related to myapp
puppi log myapp




                              Troubleshoot in the quick way
puppi log
class puppi::logs {

    puppi::log { "auth":
        description => "Users and authentication" ,
        log => $operatingsystem ? {
            Debian,Ubuntu => [ "/var/log/user.log” ,
                               “/var/log/auth.log" ],
            RedHat,CentOS => "/var/log/secure",
        }
    }

    puppi::log { "mail":
        description => "Mail messages" ,
        log => $operatingsystem ? {
            Debian,Ubuntu => "/var/log/mail.log",
            RedHat,CentOS => "/var/log/maillog",
        }
    }

    [...]
}
puppi deploy



Automating
deployment
procedures
puppi deploy
# To make this work:

puppi deploy www.lab42.it



# You write something like:

puppi::project::builder { "www.lab42.it":
    source       => "rsync://deploy.${domain}/deploy/www.lab42.it/",
    init_source => "rsync://deploy.${domain}/init/www.lab42.it",
    source_type => "dir",
    deploy_root => "${apache::params::documentroot}/www.lab42.it/",
    user         => "root",
    disable_services => “apache”,
    run_checks   => “true”,
    backup       => “full”,
    report_email => "roots@lab42.it",
    enable       => "true",
}
puppi deploy
# Default sample deploy procedures (can be customized)
# Check puppi/manifests/project/*.pp

puppi::project::builder # General purpose scenario.
                        # Includes most of the cases below

puppi::project::war # Deploy a simple war

puppi::project::tar # Deploy a tar.gz file

puppi::project::maven # Deploy Maven artifacts published on a
                      # Nexus repository

puppi::project::mysql # Retrieve and imports a .sql file

puppi::project::files # Deploy the files defined in a list
puppi deploy
# SOME options available in puppi::project::builder
# Use them to adapt the default procedures to custom needs

define puppi::project::builder (
    $source, # URI of source files: http://, ssh://, rsync://...
    $source_type, # Type of source: tarball, zip, war, dir, maven...
    $deploy_root, # Destination directory
    $init_source="", # Source for init command
    $user="root", # User that makes the deploy
    $predeploy_customcommand="", # Optional pre-deploy command
    $postdeploy_customcommand="", # Optional post-deploy command
    $disable_services="", # Services to stop during deploy.
    $firewall_src_ip="", # Load balancer IP
    $report_email="", # Email(s) to notify at the end of the run
    $backup="full", # Backup method for archiving old data
    $run_checks="true", # If pre and post deploy checks are run
    [...] ) {
puppi deploy
# A deploy procedure contains basic puppi defines:
# puppi::deploy, init, project, rollback, report

# A sample fragment:
puppi::deploy {
    "${name}-Retrieve_SourceFile":
         priority => "20" , command => "get_file.sh" ,
         arguments => "-s $source -t $real_source_type" ,
         user => "root" , project => "$name" , enable => $enable ;
    "${name}-Deploy":
         priority => "40" , command => "deploy.sh" ,
         arguments => "$deploy_root" ,
         user => "$user" , project => "$name" , enable => $enable;
}
puppi deploy
# The commands executed can be in any language
# By default Puppi provides some native commands for general uses:

get_file.sh # Retrieve a file using different protocols:
             # http://, ssh://, file://, svn://, rsync:// ...
archive.sh # Backup and recovery data with various options
deploy.sh    # Copy files to the deploy directory
wait.sh      # Wait for events (file presence, content check, time...)
predeploy.sh     # Prepare files to deploy
get_metadata.sh # Extract metadata from various sources
database.sh      # Run database queries

# These and other scripts are placed in /etc/puppi/scripts and can
# be used during the deploy procedure

# All the native scripts use and can write to a runtime
# configuration file where are stored parameters related
# to the deployment.
puppi paths
/usr/sbin/puppi # The puppi main command
/etc/puppi/     # All puppi configs and scripts
/etc/puppi/scripts/ # Where commands are placed

/etc/puppi/checks/ # Where checks are defined (Nagios plugins)
/etc/puppi/info/   # Where are placed info topic scripts
/etc/puppi/logs/   # Where are placed log topic paths

/etc/puppi/projects/ # Where are stored deploy projects dirs
/etc/puppi/projects/<project_name>/deploy/ # Commands executed
    # when you type: puppi deploy <project_name>

/tmp/puppi/<project_name>/ # Temporary dir used during a deploy
/var/lib/puppi/<project_name>/ # Where backups are stored
/var/log/puppi/<project_name>/ # Where logs are stored
puppi
rollback


If something
can go wrong...



  One command solves
puppi rollback
[root@pg01 ~]# puppi rollback www.lab42.it
Puppi setup: 00-www.lab42.it-RuntimeConfig-Initialization    [   OK    ]


Choose deploy to rollback:
total 52
drwxr-xr-x 2 root root 4096 Mar 29 01:21   20110329-012108
drwxr-xr-x 2 root root 4096 Mar 29 02:59   20110329-025956
drwxr-xr-x 2 root root 4096 Apr 10 22:05   20110410-215942
drwxr-xr-x 2 root root 4096 Apr 19 23:55   20110419-235528
drwxr-xr-x 2 root root 4096 Apr 20 02:41   20110420-024115
drwxr-xr-x 2 root root 4096 Apr 20 02:56   20110420-025621
lrwxrwxrwx 1 root root   51 Apr 20 02:56   latest -> /var/lib/puppi/
archive/www.lab42.it/20110420-025621




            Rollback operations require user’s interaction
puppi init



Automating
first time
deployments
puppi init
[root@pg02 ~]# puppi init www.lab42.it
Puppi setup: 00-www.lab42.it-RuntimeConfig-Initialization   [   OK   ]

pg02 Init: 40-www.lab42.it-Deploy_Files                     [   OK   ]

Reporting: 20-www.lab42.it-Mail_Notification                [   OK   ]

REPORT FOR PUPPI - STATUS OK
Summary of operations is: /var/log/puppi/www.lab42.it/
20110423-005555/summary
Details are in: /var/log/puppi/www.lab42.it/20110423-005555/
Temporary workdir has been: /tmp/puppi/www.lab42.it/ (Will be
rewritten at the next puppi run)
Runtime config file is: /tmp/puppi/www.lab42.it/config
Files have been archived in: /var/lib/puppi/archive/www.lab42.it/
20110423-005555
Job done.



Notification plugins
mail notify
# Usage in a puppi::project define
    report_email => "roots@lab42.it al@lab42.it",

# The actual code that makes it
    puppi::report {
        "${name}-Mail_Notification":
             command => "report_mail.sh" ,
             arguments => "$report_email" ,
             project => "$name" ,
    }
mc-puppi



Expanding
to a wider
world
mc-puppi
# Some examples
# Distributed real time check of the whole Infrastructure
mc-puppi check

# Gather network info of all nodes
mc-puppi info network

# Deploy myapp on all the nodes of the myapp-fe role
mc-puppi -F role=myapp-fe deploy myapp

# Instant check on the nodes where you deployed
mc-puppi -F role=myapp-fe check

# Realtime info on relevant services
mc-puppi -F role=myapp-fe info apache

# Check last log entries
mc-puppi -F role=myapp-fe log apache


           Bringing puppi commands to MCollective space
mc-puppi
More notification methods
Wider OS support
Web Frontend
Orchestra
Dowload from:

www.example42.com
github.com/example42
Graphics by Tatlin
 www.tatlin.net

Mais conteúdo relacionado

Mais procurados

Essential applications management with Tiny Puppet
Essential applications management with Tiny PuppetEssential applications management with Tiny Puppet
Essential applications management with Tiny PuppetAlessandro Franceschi
 
Puppet modules: An Holistic Approach
Puppet modules: An Holistic ApproachPuppet modules: An Holistic Approach
Puppet modules: An Holistic ApproachAlessandro Franceschi
 
Doing It Wrong with Puppet -
Doing It Wrong with Puppet - Doing It Wrong with Puppet -
Doing It Wrong with Puppet - Puppet
 
Puppet Systems Infrastructure Construction Kit
Puppet Systems Infrastructure Construction KitPuppet Systems Infrastructure Construction Kit
Puppet Systems Infrastructure Construction KitAlessandro Franceschi
 
Puppet Camp Phoenix 2015: Managing Files via Puppet: Let Me Count The Ways (B...
Puppet Camp Phoenix 2015: Managing Files via Puppet: Let Me Count The Ways (B...Puppet Camp Phoenix 2015: Managing Files via Puppet: Let Me Count The Ways (B...
Puppet Camp Phoenix 2015: Managing Files via Puppet: Let Me Count The Ways (B...Puppet
 
Configuration Surgery with Augeas
Configuration Surgery with AugeasConfiguration Surgery with Augeas
Configuration Surgery with AugeasPuppet
 
Puppet Continuous Integration with PE and GitLab
Puppet Continuous Integration with PE and GitLabPuppet Continuous Integration with PE and GitLab
Puppet Continuous Integration with PE and GitLabAlessandro Franceschi
 
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
 
Developing IT infrastructures with Puppet
Developing IT infrastructures with PuppetDeveloping IT infrastructures with Puppet
Developing IT infrastructures with PuppetAlessandro Franceschi
 
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)Robert Nelson
 
PECL Picks - Extensions to make your life better
PECL Picks - Extensions to make your life betterPECL Picks - Extensions to make your life better
PECL Picks - Extensions to make your life betterZendCon
 
PuppetCamp SEA 1 - Puppet Deployment at OnApp
PuppetCamp SEA 1 - Puppet Deployment  at OnAppPuppetCamp SEA 1 - Puppet Deployment  at OnApp
PuppetCamp SEA 1 - Puppet Deployment at OnAppWalter Heck
 
Puppet for dummies - ZendCon 2011 Edition
Puppet for dummies - ZendCon 2011 EditionPuppet for dummies - ZendCon 2011 Edition
Puppet for dummies - ZendCon 2011 EditionJoshua Thijssen
 
PuppetCamp SEA 1 - Use of Puppet
PuppetCamp SEA 1 - Use of PuppetPuppetCamp SEA 1 - Use of Puppet
PuppetCamp SEA 1 - Use of PuppetWalter Heck
 

Mais procurados (20)

Essential applications management with Tiny Puppet
Essential applications management with Tiny PuppetEssential applications management with Tiny Puppet
Essential applications management with Tiny Puppet
 
ReUse Your (Puppet) Modules!
ReUse Your (Puppet) Modules!ReUse Your (Puppet) Modules!
ReUse Your (Puppet) Modules!
 
Intro to-puppet
Intro to-puppetIntro to-puppet
Intro to-puppet
 
Puppet modules: An Holistic Approach
Puppet modules: An Holistic ApproachPuppet modules: An Holistic Approach
Puppet modules: An Holistic Approach
 
Doing It Wrong with Puppet -
Doing It Wrong with Puppet - Doing It Wrong with Puppet -
Doing It Wrong with Puppet -
 
Puppet Systems Infrastructure Construction Kit
Puppet Systems Infrastructure Construction KitPuppet Systems Infrastructure Construction Kit
Puppet Systems Infrastructure Construction Kit
 
Puppet Camp Phoenix 2015: Managing Files via Puppet: Let Me Count The Ways (B...
Puppet Camp Phoenix 2015: Managing Files via Puppet: Let Me Count The Ways (B...Puppet Camp Phoenix 2015: Managing Files via Puppet: Let Me Count The Ways (B...
Puppet Camp Phoenix 2015: Managing Files via Puppet: Let Me Count The Ways (B...
 
Power of Puppet 4
Power of Puppet 4Power of Puppet 4
Power of Puppet 4
 
Configuration Surgery with Augeas
Configuration Surgery with AugeasConfiguration Surgery with Augeas
Configuration Surgery with Augeas
 
Puppet Continuous Integration with PE and GitLab
Puppet Continuous Integration with PE and GitLabPuppet Continuous Integration with PE and GitLab
Puppet Continuous Integration with PE and GitLab
 
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_training
Puppet_trainingPuppet_training
Puppet_training
 
Developing IT infrastructures with Puppet
Developing IT infrastructures with PuppetDeveloping IT infrastructures with Puppet
Developing IT infrastructures with Puppet
 
Tp install anything
Tp install anythingTp install anything
Tp install anything
 
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)
 
PECL Picks - Extensions to make your life better
PECL Picks - Extensions to make your life betterPECL Picks - Extensions to make your life better
PECL Picks - Extensions to make your life better
 
PuppetCamp SEA 1 - Puppet Deployment at OnApp
PuppetCamp SEA 1 - Puppet Deployment  at OnAppPuppetCamp SEA 1 - Puppet Deployment  at OnApp
PuppetCamp SEA 1 - Puppet Deployment at OnApp
 
Puppet fundamentals
Puppet fundamentalsPuppet fundamentals
Puppet fundamentals
 
Puppet for dummies - ZendCon 2011 Edition
Puppet for dummies - ZendCon 2011 EditionPuppet for dummies - ZendCon 2011 Edition
Puppet for dummies - ZendCon 2011 Edition
 
PuppetCamp SEA 1 - Use of Puppet
PuppetCamp SEA 1 - Use of PuppetPuppetCamp SEA 1 - Use of Puppet
PuppetCamp SEA 1 - Use of Puppet
 

Semelhante a Puppi. Puppet strings to the shell

Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013grim_radical
 
Virtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + PuppetVirtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + PuppetOmar Reygaert
 
Writing and Publishing Puppet Modules - PuppetConf 2014
Writing and Publishing Puppet Modules - PuppetConf 2014Writing and Publishing Puppet Modules - PuppetConf 2014
Writing and Publishing Puppet Modules - PuppetConf 2014Puppet
 
Installaling Puppet Master and Agent
Installaling Puppet Master and AgentInstallaling Puppet Master and Agent
Installaling Puppet Master and AgentRanjit Avasarala
 
Ansible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife OrchestrationAnsible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife Orchestrationbcoca
 
How to automate all your SEO projects
How to automate all your SEO projectsHow to automate all your SEO projects
How to automate all your SEO projectsVincent Terrasi
 
2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Herokuronnywang_tw
 
Node.js basics
Node.js basicsNode.js basics
Node.js basicsBen Lin
 
PM : code faster
PM : code fasterPM : code faster
PM : code fasterPHPPRO
 
Introduction to PowerShell
Introduction to PowerShellIntroduction to PowerShell
Introduction to PowerShellBoulos Dib
 
The Grand Puppet Sub-Systems Tour - Nicholas Fagerlund, Puppet Labs
The Grand Puppet Sub-Systems Tour - Nicholas Fagerlund, Puppet LabsThe Grand Puppet Sub-Systems Tour - Nicholas Fagerlund, Puppet Labs
The Grand Puppet Sub-Systems Tour - Nicholas Fagerlund, Puppet LabsPuppet
 
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
 
Puppet HackDay/BarCamp New Delhi Exercises
Puppet HackDay/BarCamp New Delhi ExercisesPuppet HackDay/BarCamp New Delhi Exercises
Puppet HackDay/BarCamp New Delhi ExercisesJulie Tsai
 
Lean Php Presentation
Lean Php PresentationLean Php Presentation
Lean Php PresentationAlan Pinstein
 
linux_Commads
linux_Commadslinux_Commads
linux_Commadstastedone
 
Installing odoo v8 from github
Installing odoo v8 from githubInstalling odoo v8 from github
Installing odoo v8 from githubAntony Gitomeh
 
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012Carlos Sanchez
 

Semelhante a Puppi. Puppet strings to the shell (20)

Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013
 
Puppet
PuppetPuppet
Puppet
 
Virtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + PuppetVirtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + Puppet
 
Writing and Publishing Puppet Modules - PuppetConf 2014
Writing and Publishing Puppet Modules - PuppetConf 2014Writing and Publishing Puppet Modules - PuppetConf 2014
Writing and Publishing Puppet Modules - PuppetConf 2014
 
Installaling Puppet Master and Agent
Installaling Puppet Master and AgentInstallaling Puppet Master and Agent
Installaling Puppet Master and Agent
 
Ansible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife OrchestrationAnsible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife Orchestration
 
Puppet Camp 2012
Puppet Camp 2012Puppet Camp 2012
Puppet Camp 2012
 
Puppet
PuppetPuppet
Puppet
 
How to automate all your SEO projects
How to automate all your SEO projectsHow to automate all your SEO projects
How to automate all your SEO projects
 
2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku
 
Node.js basics
Node.js basicsNode.js basics
Node.js basics
 
PM : code faster
PM : code fasterPM : code faster
PM : code faster
 
Introduction to PowerShell
Introduction to PowerShellIntroduction to PowerShell
Introduction to PowerShell
 
The Grand Puppet Sub-Systems Tour - Nicholas Fagerlund, Puppet Labs
The Grand Puppet Sub-Systems Tour - Nicholas Fagerlund, Puppet LabsThe Grand Puppet Sub-Systems Tour - Nicholas Fagerlund, Puppet Labs
The Grand Puppet Sub-Systems Tour - Nicholas Fagerlund, Puppet Labs
 
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)
 
Puppet HackDay/BarCamp New Delhi Exercises
Puppet HackDay/BarCamp New Delhi ExercisesPuppet HackDay/BarCamp New Delhi Exercises
Puppet HackDay/BarCamp New Delhi Exercises
 
Lean Php Presentation
Lean Php PresentationLean Php Presentation
Lean Php Presentation
 
linux_Commads
linux_Commadslinux_Commads
linux_Commads
 
Installing odoo v8 from github
Installing odoo v8 from githubInstalling odoo v8 from github
Installing odoo v8 from github
 
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012
 

Mais de Alessandro Franceschi

Mais de Alessandro Franceschi (8)

Strategies for Puppet code upgrade and refactoring
Strategies for Puppet code upgrade and refactoringStrategies for Puppet code upgrade and refactoring
Strategies for Puppet code upgrade and refactoring
 
DevOps - Evoluzione della specie - DevOps Heroes.pdf
DevOps - Evoluzione della specie - DevOps Heroes.pdfDevOps - Evoluzione della specie - DevOps Heroes.pdf
DevOps - Evoluzione della specie - DevOps Heroes.pdf
 
Tiny Puppet Can Install Everything. Prove me wrong!
Tiny Puppet Can Install Everything. Prove me wrong!Tiny Puppet Can Install Everything. Prove me wrong!
Tiny Puppet Can Install Everything. Prove me wrong!
 
Ten years of [Puppet] installations. What now?
Ten years of [Puppet] installations. What now?Ten years of [Puppet] installations. What now?
Ten years of [Puppet] installations. What now?
 
Puppet evolutions
Puppet evolutionsPuppet evolutions
Puppet evolutions
 
Raise the bar! Reloaded
Raise the bar! ReloadedRaise the bar! Reloaded
Raise the bar! Reloaded
 
Raise the bar!
Raise the bar!Raise the bar!
Raise the bar!
 
Spaghetti devops
Spaghetti devopsSpaghetti devops
Spaghetti devops
 

Último

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 

Último (20)

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 

Puppi. Puppet strings to the shell

  • 1. PuppetCamp Europe 2011 27/28 April Amsterdam
  • 2. What’s Puppi? A Puppet Module A Bash Command A tool to automate deployments A SysAdmin friend
  • 4. puppi Usage: puppi <command> [project|topic] [options] Available commands: check [project] - Run puppi checks host-wide or for project log [topic] [-i] - Show system and application specific logs info [topic] [-i] - Show informations about the system init <project> - First time project initialization and setup deploy <project> - Deploy the specified project rollback <project> - Rollback the specified project. Available options: -f - Force puppi commands execution flow also on CRITICAL errors -i - Interactively ask confirmation for every step -t - Test mode. Just show the commands that should be executed -d <yes|full> - Debug mode. Show debug of what is done. -o "parameter=value parameter2=value2" - Set manual options to override defaults Available projects: abnormalia.net git.example42.com openskills.info openskills.info_sql www.example42.com www.example42.com_sql www.lab42.it Available info topics: apache! disks hardware mcollective munin mysql network nrpe ntp! openssh packages perf postfix puppi rsync! users Available log topics: abnormalia.net! auth git.example42.com mail mcollective munin mysql openskills.info rsync system www.example42.com www.lab42.it
  • 6. puppi check # Run all local checks puppi check # Run checks related to myapp puppi check myapp # Checks can be on: # - Running services # - Listening ports # - Pattern match on specific URLs # - General system’s status # - Remote services used by the host # # - Whatever a Nagios plugin can check
  • 7. puppi check # Each check is a Puppet define puppi::check { "NTP_Sync": command => "check_ntp -H ${puppi::params::ntp_server}" , priority => "20" , hostwide => "yes" , } puppi::check { "Port_exim_$port": command => "check_tcp -H ${fqdn} -p ${exim::params::port}" , } puppi::check { "Url_$name": enable => $enable, hostwide => no, project => “myapp”, command => "check_http -I '${target}' -p '${port}' -u '$ {url}' -s '${pattern}'" , }
  • 9. puppi info # Show all the info available puppi info # Interactive. Select the topics to show puppi info -i # Check local resources puppi info network puppi info perf # Module based info sources puppi info openssh puppi info apache # Company and node specific info puppi info mycompany
  • 10. puppi info puppi::info { "network": description => "Network settings and stats" , run => [ "ifconfig”,“route”,“cat /etc resolv.conf”, “netstat -natup|grep LISTEN" ], } puppi::info::module { "openssh": packagename => "${openssh::params::packagename}", servicename => "${openssh::params::servicename}", processname => "${openssh::params::processname}", configfile => "${openssh::params::configfile}", datadir => "${openssh::params::datadir}", logdir => "${openssh::params::logdir}", protocol => "${openssh::params::protocol}", port => "${openssh::params::port}", description => "What Puppet knows about openssh" , run => "ls -la ~/.ssh/", } puppi::info::readme { "mycompany": }
  • 11. puppi log All logs in a single command
  • 12. puppi log # tail -f of all the known logs puppi log # Interactive. CHoose logs to show puppi log -i # Tail of logs related to myapp puppi log myapp Troubleshoot in the quick way
  • 13. puppi log class puppi::logs { puppi::log { "auth": description => "Users and authentication" , log => $operatingsystem ? { Debian,Ubuntu => [ "/var/log/user.log” , “/var/log/auth.log" ], RedHat,CentOS => "/var/log/secure", } } puppi::log { "mail": description => "Mail messages" , log => $operatingsystem ? { Debian,Ubuntu => "/var/log/mail.log", RedHat,CentOS => "/var/log/maillog", } } [...] }
  • 15. puppi deploy # To make this work: puppi deploy www.lab42.it # You write something like: puppi::project::builder { "www.lab42.it": source => "rsync://deploy.${domain}/deploy/www.lab42.it/", init_source => "rsync://deploy.${domain}/init/www.lab42.it", source_type => "dir", deploy_root => "${apache::params::documentroot}/www.lab42.it/", user => "root", disable_services => “apache”, run_checks => “true”, backup => “full”, report_email => "roots@lab42.it", enable => "true", }
  • 16. puppi deploy # Default sample deploy procedures (can be customized) # Check puppi/manifests/project/*.pp puppi::project::builder # General purpose scenario. # Includes most of the cases below puppi::project::war # Deploy a simple war puppi::project::tar # Deploy a tar.gz file puppi::project::maven # Deploy Maven artifacts published on a # Nexus repository puppi::project::mysql # Retrieve and imports a .sql file puppi::project::files # Deploy the files defined in a list
  • 17. puppi deploy # SOME options available in puppi::project::builder # Use them to adapt the default procedures to custom needs define puppi::project::builder ( $source, # URI of source files: http://, ssh://, rsync://... $source_type, # Type of source: tarball, zip, war, dir, maven... $deploy_root, # Destination directory $init_source="", # Source for init command $user="root", # User that makes the deploy $predeploy_customcommand="", # Optional pre-deploy command $postdeploy_customcommand="", # Optional post-deploy command $disable_services="", # Services to stop during deploy. $firewall_src_ip="", # Load balancer IP $report_email="", # Email(s) to notify at the end of the run $backup="full", # Backup method for archiving old data $run_checks="true", # If pre and post deploy checks are run [...] ) {
  • 18. puppi deploy # A deploy procedure contains basic puppi defines: # puppi::deploy, init, project, rollback, report # A sample fragment: puppi::deploy { "${name}-Retrieve_SourceFile": priority => "20" , command => "get_file.sh" , arguments => "-s $source -t $real_source_type" , user => "root" , project => "$name" , enable => $enable ; "${name}-Deploy": priority => "40" , command => "deploy.sh" , arguments => "$deploy_root" , user => "$user" , project => "$name" , enable => $enable; }
  • 19. puppi deploy # The commands executed can be in any language # By default Puppi provides some native commands for general uses: get_file.sh # Retrieve a file using different protocols: # http://, ssh://, file://, svn://, rsync:// ... archive.sh # Backup and recovery data with various options deploy.sh # Copy files to the deploy directory wait.sh # Wait for events (file presence, content check, time...) predeploy.sh # Prepare files to deploy get_metadata.sh # Extract metadata from various sources database.sh # Run database queries # These and other scripts are placed in /etc/puppi/scripts and can # be used during the deploy procedure # All the native scripts use and can write to a runtime # configuration file where are stored parameters related # to the deployment.
  • 20. puppi paths /usr/sbin/puppi # The puppi main command /etc/puppi/ # All puppi configs and scripts /etc/puppi/scripts/ # Where commands are placed /etc/puppi/checks/ # Where checks are defined (Nagios plugins) /etc/puppi/info/ # Where are placed info topic scripts /etc/puppi/logs/ # Where are placed log topic paths /etc/puppi/projects/ # Where are stored deploy projects dirs /etc/puppi/projects/<project_name>/deploy/ # Commands executed # when you type: puppi deploy <project_name> /tmp/puppi/<project_name>/ # Temporary dir used during a deploy /var/lib/puppi/<project_name>/ # Where backups are stored /var/log/puppi/<project_name>/ # Where logs are stored
  • 21. puppi rollback If something can go wrong... One command solves
  • 22. puppi rollback [root@pg01 ~]# puppi rollback www.lab42.it Puppi setup: 00-www.lab42.it-RuntimeConfig-Initialization [ OK ] Choose deploy to rollback: total 52 drwxr-xr-x 2 root root 4096 Mar 29 01:21 20110329-012108 drwxr-xr-x 2 root root 4096 Mar 29 02:59 20110329-025956 drwxr-xr-x 2 root root 4096 Apr 10 22:05 20110410-215942 drwxr-xr-x 2 root root 4096 Apr 19 23:55 20110419-235528 drwxr-xr-x 2 root root 4096 Apr 20 02:41 20110420-024115 drwxr-xr-x 2 root root 4096 Apr 20 02:56 20110420-025621 lrwxrwxrwx 1 root root 51 Apr 20 02:56 latest -> /var/lib/puppi/ archive/www.lab42.it/20110420-025621 Rollback operations require user’s interaction
  • 24. puppi init [root@pg02 ~]# puppi init www.lab42.it Puppi setup: 00-www.lab42.it-RuntimeConfig-Initialization [ OK ] pg02 Init: 40-www.lab42.it-Deploy_Files [ OK ] Reporting: 20-www.lab42.it-Mail_Notification [ OK ] REPORT FOR PUPPI - STATUS OK Summary of operations is: /var/log/puppi/www.lab42.it/ 20110423-005555/summary Details are in: /var/log/puppi/www.lab42.it/20110423-005555/ Temporary workdir has been: /tmp/puppi/www.lab42.it/ (Will be rewritten at the next puppi run) Runtime config file is: /tmp/puppi/www.lab42.it/config Files have been archived in: /var/lib/puppi/archive/www.lab42.it/ 20110423-005555
  • 26. mail notify # Usage in a puppi::project define report_email => "roots@lab42.it al@lab42.it", # The actual code that makes it     puppi::report {         "${name}-Mail_Notification":              command => "report_mail.sh" , arguments => "$report_email" , project => "$name" ,     }
  • 28. mc-puppi # Some examples # Distributed real time check of the whole Infrastructure mc-puppi check # Gather network info of all nodes mc-puppi info network # Deploy myapp on all the nodes of the myapp-fe role mc-puppi -F role=myapp-fe deploy myapp # Instant check on the nodes where you deployed mc-puppi -F role=myapp-fe check # Realtime info on relevant services mc-puppi -F role=myapp-fe info apache # Check last log entries mc-puppi -F role=myapp-fe log apache Bringing puppi commands to MCollective space
  • 30.
  • 31. More notification methods Wider OS support Web Frontend Orchestra
  • 33. Graphics by Tatlin www.tatlin.net