Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Puppet 4.10 Beginner???s Guide, Second Edition
Puppet 4.10 Beginner???s Guide, Second Edition

Puppet 4.10 Beginner???s Guide, Second Edition: From newbie to pro with Puppet 4.10 , Second Edition

Arrow left icon
Profile Icon John Arundel
Arrow right icon
₱579.99 ₱1796.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.5 (4 Ratings)
eBook May 2017 268 pages 2nd Edition
eBook
₱579.99 ₱1796.99
Paperback
₱2245.99
Subscription
Free Trial
Arrow left icon
Profile Icon John Arundel
Arrow right icon
₱579.99 ₱1796.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.5 (4 Ratings)
eBook May 2017 268 pages 2nd Edition
eBook
₱579.99 ₱1796.99
Paperback
₱2245.99
Subscription
Free Trial
eBook
₱579.99 ₱1796.99
Paperback
₱2245.99
Subscription
Free Trial

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Puppet 4.10 Beginner???s Guide, Second Edition

Chapter 2. Creating your first manifests

Beginnings are such delicate times.

—Frank Herbert, Dune

In this chapter, you'll learn how to write your first manifest with Puppet, and how to put Puppet to work configuring a server. You'll also understand how Puppet compiles and applies a manifest. You'll see how to use Puppet to manage the contents of files, how to install packages, and how to control services.

Creating your first manifests

Hello, Puppet – your first Puppet manifest

The first example program in any programming language, by tradition, prints hello, world. Although we can do that easily in Puppet, let's do something a little more ambitious, and have Puppet create a file on the server containing that text.

On your Vagrant box, run the following commands:

   cat /vagrant/examples/file_hello.pp
file { '/tmp/hello.txt':
  ensure  => file,
  content => "hello, world\n",
}

Tip

If you're not using the Vagrant box, copy the file examples/file_hello.pp from the puppet-beginners-guide Git repo to the server you're using to try out Puppet.

Now apply it with the following command:

   sudo puppet apply /vagrant/examples/file_hello.pp
Notice: Compiled catalog for localhost in environment production in 0.07 seconds
Notice: /Stage[main]/Main/File[/tmp/hello.txt]/ensure: defined content as '{md5}22c3683b094136c3398391ae71b20f04'
Notice: Applied catalog in 0.01 seconds

Tip

If...

Managing packages

Another key resource type in Puppet is the package. A major part of configuring servers by hand involves installing packages, so we will also be using packages a lot in Puppet manifests. Although every operating system has its own package format, and different formats vary quite a lot in their capabilities, Puppet represents all these possibilities with a single package type. If you specify in your Puppet manifest that a given package should be installed, Puppet will use the appropriate package manager commands to install it on whatever platform it's running on.

As you've seen, all resource declarations in Puppet follow the following form:

RESOURCE_TYPE { TITLE:
  ATTRIBUTE => VALUE,
  ...
}

Package resources are no different. RESOURCE_TYPE is the package, and the only attribute you usually need to specify is ensure, and the only value it usually needs to take is installed:

package { 'cowsay':
  ensure => installed,
}

Try this example:

   sudo puppet...

Services

The third most important Puppet resource type is the service, a long-running process which either does some continuous kind of work, or waits for requests and then acts on them. For example, on most systems, the sshd process runs all the time and listens for SSH login attempts.

Puppet models services with the service resource type. Service resources look like the following example (you can find this in service.pp in the /vagrant/examples directory. From now on, I'll just give the filename of each example, as they are all in the same directory):

service { 'sshd':
  ensure => running,
  enable => true,
}

The ensure parameter governs whether the service should be running or not. If its value is running then, as you might expect, Puppet will start the service if it is not running. If you set ensure to stopped, Puppet will stop the service if it is running.

Services may also be set to start when the system boots, using the enable parameter. If enable is set to true...

Summary

In this chapter, we've seen how a manifest is made up of Puppet resources. We've learned how to use Puppet's file resource to create and modify files, how to install packages using the package resource, and how to manage services with the service resource. We've looked at the common package-file-service pattern, and seen how to use the notify attribute on a resource to send a message to another resource that its configuration has been updated. We've covered the use of the require attribute to make dependencies between resources explicit, when necessary.

We've also learned to use puppet resource to inspect the current state of the system according to Puppet, and puppet describe to get command-line help on all Puppet resources. To check what Puppet would change on the system, without actually changing it, we've introduced the --noop and --show_diff options to puppet apply.

In the next chapter, we'll see how to use the version control tool Git...

Left arrow icon Right arrow icon

Key benefits

  • Develop skills to run Puppet 4.10 on single or multiple servers without hiccups
  • Use Puppet to spin up and manage cloud resources such as Amazon EC2 instances
  • Take full advantage of the powerful new features of Puppet 4.10, including loops, data types, structured facts, R10K module management, control repos, and EPP templates

Description

Puppet 4.10 Beginner’s Guide, Second Edition, gets you up and running with the very latest features of Puppet 4.10, including Docker containers, Hiera data, and Amazon AWS cloud orchestration. Go from beginner to confident Puppet user with a series of clear, practical examples to help you manage every aspect of your server setup. Whether you’re a developer, a system administrator, or you are simply curious about Puppet, you’ll learn Puppet skills that you can put into practice right away. With practical steps giving you the key concepts you need, this book teaches you how to install packages and config files, create users, set up scheduled jobs, provision cloud instances, build containers, and so much more. Every example in this book deals with something real and practical that you’re likely to need in your work, and you’ll see the complete Puppet code that makes it happen, along with step-by-step instructions for what to type and what output you’ll see. All the examples are available in a GitHub repo for you to download and adapt for your own server setup.

Who is this book for?

Puppet Beginner’s Guide, Second Edition is designed for those who are new to Puppet, including system administrators and developers who are looking to manage computer server systems for configuration management. No prior programming or system administration experience is assumed.

What you will learn

  • •Covers the latest Puppet 4.10 release
  • •Install and set up Puppet and discover the latest and most advanced features
  • •Configure, build, and run containers in production using Puppet's industry-leading Docker support
  • •Deploy configuration files and templates at super-fast speeds and manage user accounts and access control
  • •Automate your IT infrastructure
  • •Use the latest features in Puppet 4 onward and its official modules
  • •Manage clouds, containers, and orchestration
  • •Get to know the best practices to make Puppet more reliable and increase its performance

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : May 31, 2017
Length: 268 pages
Edition : 2nd
Language : English
ISBN-13 : 9781787120969
Vendor :
Puppet
Languages :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : May 31, 2017
Length: 268 pages
Edition : 2nd
Language : English
ISBN-13 : 9781787120969
Vendor :
Puppet
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just ₱260 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just ₱260 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 11,686.97
Puppet 4.10 Beginner???s Guide, Second Edition
₱2245.99
Puppet: Mastering Infrastructure Automation
₱4337.99
DevOps: Puppet, Docker, and Kubernetes
₱5102.99
Total 11,686.97 Stars icon
Banner background image

Table of Contents

13 Chapters
1. Getting started with Puppet Chevron down icon Chevron up icon
2. Creating your first manifests Chevron down icon Chevron up icon
3. Managing your Puppet code with Git Chevron down icon Chevron up icon
4. Understanding Puppet resources Chevron down icon Chevron up icon
5. Variables, expressions, and facts Chevron down icon Chevron up icon
6. Managing data with Hiera Chevron down icon Chevron up icon
7. Mastering modules Chevron down icon Chevron up icon
8. Classes, roles, and profiles Chevron down icon Chevron up icon
9. Managing files with templates Chevron down icon Chevron up icon
10. Controlling containers Chevron down icon Chevron up icon
11. Orchestrating cloud resources Chevron down icon Chevron up icon
12. Putting it all together Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.5
(4 Ratings)
5 star 50%
4 star 50%
3 star 0%
2 star 0%
1 star 0%
Pedro Galan Aug 09, 2017
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Very clear explanations for newbies.
Amazon Verified review Amazon
John Sep 23, 2017
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I'm only half way through the book but I've thoroughly enjoyed it so far. It explains the subject matter very well and takes a lot of the mystery out of Puppet. If you are looking for a way into Puppet I highly recommend this book by the well respected author, John Arundel.
Amazon Verified review Amazon
Ryan Estep Dec 13, 2017
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
I am using the book to aide my work right now. I would like a lecture series to go with it. Then I would give it five stars.
Amazon Verified review Amazon
Paul Nov 20, 2017
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Considered that I've used puppet in production environment and have an basic of certain features within puppet this book def did it's job by allowing me to fully understand features I did not know. I would recommend for newbie!
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.