Puppet User Handbook

Are you a programmer looking for a powerful tool to manage your servers? If yes, then you must take puppet into your consideration. This puppets cheat sheet is designed for the one who has started learning about the server management and using Puppet as a tool, then this sheet will be handy reference sheet. Don’t worry if you are a beginner and have no idea about how puppet works, this puppet cheat sheet will give you a quick reference of the basics that you must know to get started.
Prepare yourself for the Top DevOps Interview Questions And Answers!

Watch this Puppet Tutorial for Beginners video

In early days, everything was done manually like inspecting, operating and delivering the operating applications. It is an open – source configuration framework. Puppet is a tool which gives an automatic way of inspecting, delivering and operating the applications faster. It helps in discovering the content in cloud, containers and on-premises and what software runs on them.

You can also download the printable PDF of Puppet Cheat Sheet.

Puppet Cheat Sheet
Become Master of DevOps by going through this online DevOps training in London.

What is Puppet?

It is an open source system management tool used for automating configuration management which is a detailed recording and updating of information that describes the enterprise software and hardware

  • It is an open source configuration framework.
  • Useful:
    • When you have a lot of machines needed to be configured in a similar form.
    • When you have an infrastructure that requires dynamic scaling up or down with pre-determined config
    • To have control over all the config machines so that a centralized change gets propagated.

Puppet Architecture:  It shows the component and workflow of puppet
Puppet Architecture

  • Node: It consists of a block of Puppet code
  • Puppet Master: The node which controls the flow and has the authority
  • Catalog: It is a document which describes the state of resources on a node which is managed by Puppet
  • Report: The actions and infrastructure applied by a catalog during a Puppet run

Go through the Best DevOps Course in New York to get clear understanding of DevOps.
Files:  In puppet all the programs written in any programming language are stored in a file which is used to manage the directories and symlinks

  • Manages files directories and symlink
  • Attributes:

    • Ensure- if the file exists or not, what it should be. Allowed:
      • File
      • Directory
      • Link
      • Present
      • Absent
    • Normal files:
      • Source- source of file
      • Content- desired contents as a string
    • Directories
      • Source- Source of a file
      • Recurse-Whether to recursively manage the files in it
      • Purge- Whether unmanaged files in the directory should be deleted,
    • Symlinks
      • Target- symlink target
    • Others: backup,checksum,force,ignore,links,replace
  • Package: It is used to manage software packages.
    • Manage software packages
    • Attributes:
      • Name-name of package
      • Ensure-if it should be installed or not
      • Present
      • Latest
      • Absent
      • Purged
      • Source- where to obtain the package
      • Provider- which packaging system to use

Learn more about DevOps in this DevOps training in Sydney to get ahead in your career!

  • Service: It is used to perform routine maintenance
    • Name- The name of the service to run
    • Ensure-status- running or stopped
    • Enable- if it should start on boot
    • Hasrestart- Whether to use the init script restart command instead of stop+start
    • Hasstatus- Whether to use the init script status command.

Classes and modules:

  • Class- Defining classes makes the class available by name but not by code inside
  • Declaring a class evaluated the code inside too.
    • class my_class {
      … puppet code …
      include my_class
  • Modules- Stowing the implementation of a feature in a module, our main manifest can become much smaller, more readable, and policy-focused.
  • Module structure
    • A module is directory
    • Module and directory name has to be same
    • Contains manifest directory(contains .pp files)
    • Should contain init.pp file.

Interested in becoming DevOps Expert? Click here to learn more in this DevOps Course in Toronto!
Puppet CLI: It consists of a single Puppet command with multiple subcommands

  • Bootstrap client: Tasks that bootstrap or install Puppet on the agent node
    • puppet agent -t –server <puppet master> [<options>]
  • Display facts:
    • facter              # All system facts
      facter -p           # All system and Puppet facts
      facter -y           # YAML
      facter -j           # JSON
      facter [-p] <name>  # A specific fact
  • Injecting facts
    • env FACTER_= puppet apply site.pp
  • Find out effective classes on a node
    • cat /var/lib/puppet/classes.txt
  • File modification date
    • cd /var/lib/puppet
      for i in $(find clientbucket/ -name paths); do
      echo “$(stat -c %y $i | sed ‘s/\..*//’)       $(cat $i)”;
      done | sort -n
    • Disable to enable:
      • puppet agent –disable
        puppet agent –disable <info message> # Only recent versions
        puppet agent –enable\
    • Managing certificates:
      • puppet cert list
        puppet cert list –all
        puppet cert sign <name>
        puppet cert clean <name> # removes cert
    • Managing nodes
      • puppet node clean <name> # removes node + cert
    • Managing modules
      • puppet module list
        puppet module install <name>
        puppet module uninstall <name>
      • puppet module upgrade <name>
        puppet module search <name>
    • Inspect resources and types
      • puppet describe -l
        puppet resource <type name>
      • puppet kick <name>
        puppet kick -p 5 <names> #trigger puppet from master
    • Debugging and deployment
      • puppetd –test # enable standard debugging options
        puppetd –debug # enable full debugging
        puppetd –one-time –detailed-exitcodes # Enable exit codes:
        # 2=changes applied
        # 4=failure
    • Other commands:
Check versionPuppet –version
File content manifest -site.ppfile { ‘/tmp/dafile’:
content => “datext\n”,
File content manifest- multiple nodesnode ‘danodename’ {
file { ‘/tmp/dafile’:
content => “datext\n”,
Remove packagespackage { ‘apache2.0-common’:
ensure => absent,
Update packagespackage { ‘puppet’:
ensure => latest,
Start service at boot timeservice { ‘nginx’:
ensure => running,
enable => true, #false disables auto-startup
Set to specific versionpackage { ‘nginx’:
ensure => ‘1.1.18-1ubuntu0.1’,

Interested in getting an industry-recognized certification in DevOps? Enroll in Intellipaat’s DevOps Course in Bangalore now!

Watch this video on DevOps Tutorial for Beginners

Advantages of Puppet:

  • Infrastructure as code(IAC): – It enables to define the IAC with easy coding of few scripts. Consists of version control, peer review, automated testing and delivery
  • Downtime is reduced
  • Faster deployment times
  • Automating repetitive tasks are easy.
  • Supports a lot of platforms like windows, debian, BSD

Now, you know the most important skill set of a DevOps Engineer. But, do you know, DevOps Engineers are among the highest paid professionals in the technology domain? so join DevOps training in Hyderabad!

Download a Printable PDF of this Cheat Sheet

We have covered all the basics of Puppet in this cheat sheet. If you want to start learning DevOps in depth then check out the DevOps Certification by Intellipaat.
Not only will you get to learn and implement Puppet with a step by step guidance and support from us, but you will also get to learn other important topics in DevOps such as Docker, Chef, Git/GitHub, Ansible, Jenkins, Kubernetes, Selenium, Nagios and many more. You will also get 24*7 technical support to help you with any and all your queries, from the experts in the respective technologies here at intellipaat throughout the certification period. So, why wait? Check out the training program and enroll today!


Leave a Reply

Your email address will not be published. Required fields are marked *