Working with Puppet Apply and Manifests


by DevOpsSchool.com

Rajesh Kumar

(Senior DevOps Manager & Principal Architect)


Agenda


    The Basics

  • Introduction To Configuration Management
  • About The Author
  • Why Puppet?
  • How To Access Your Working Files

Benefits


  • Class recordings
  • Presentations
  • Assignments with personal assistance
  • Life time free re-enrollment to future Puppet courses
  • Projects

Pre-requisites


    Recommended Experience

  • Basic Linux Familiarity
  • Simple LAN Networking
  • Recommended Equipment
  • Virtualization Platform
  • Several Servers with Networking Equipment

Objectives


  • What are Puppet Manifests
  • Using Puppet Apply
  • Ensure Puppet agent is stopped and disabled
  • Puppet style guide
  • Syntax highlighting and styling in vim

Puppet Manifests



    notify {'Hello World':}
					

Hello World

The notify resource type can be used to send a message to the agent log or screen if being used interactively. This makes a great and simple first manifest.


  sudo puppet parser validate helloworld.pp
					

Validate the Manifests

Although this manifest is very simple we should get in the habit of validating code as we create it. Helping to keep our code robust and healthy.

Creating a Manifest


Puppet Architecture



    sudo puppet parser validate helloworld.pp
    sudo puppet apply -e "notify { 'Hello World': }"
					

Puppet Apply

We can use the application puppet apply to enforce a local manifest or puppet code.


   sudo pupet resource service puppet
   service { 'puppet':
		ensure => 'stopped',
		enable => false,
	}
   sudo puppet parser validate puppet-service.pp 
   sudo puppet apply puppet-service.pp
					

Controlling the Agent

We currently do want to use the Puppet agent. This can run as a daemon service so we should check that it is both stopped and disabled.


    service { 'puppet':
	ensure => 'stopped',
	enable => false,
	}
					

Ensure the Puppet Agent is not running and is disabled.

Using Puppet Apply


Puppet Style Guide


Most languages have their recommend style guide. The way the code should be laid out. The full guide is in the documentation:

http://docs.puppet.com/guide/style_guide.html


sudo puppet module install theurbanpenguin/puppet_vim
include puppet_vim
sudo puppet parser validate puppet_vim.pp
sudo puppet apply puppet_vim.pp
					

IDEs

IDEs or integrated Design Environments can help with styling. We use the text editor VIM in this course. Even this through can help with styling. It is easiest to install the required elements using a Puppet Module.

Configuring VIM and Puppet Styling


Adding Style and Color


Next up: Working with Puppet Resources


Reference


  • Reference 1
  • Reference 2
  • Reference 3

Appendix


  • Defining Nodes
  • Puppet Modules - Reusable Code
  • Provisioning A Web Server
  • Class Parameters - Applying Variables
  • Hiera Parameters - Defining Variables
  • Reporting With Puppet
      

Any Questions?


Thank You!


DevOps School — Lets Learn, Share & Practice DevOps.....

www.devopsschool.com

Connect with us on
contact@devopsschool.com | +91 700 483 5930