Discover millions of ebooks, audiobooks, and so much more with a free trial

Only $11.99/month after trial. Cancel anytime.

Extending Puppet - Second Edition
Extending Puppet - Second Edition
Extending Puppet - Second Edition
Ebook684 pages4 hours

Extending Puppet - Second Edition

Rating: 0 out of 5 stars

()

Read preview

About this ebook

About This Book
  • Explore the wider Puppet ecosystem of useful tools
  • Design and manage your Puppet architecture for optimum performance
  • Write more efficient code that keeps your infrastructure more robust
Who This Book Is For

If you are a Puppet user, this book will help you on different levels. If you are a beginner, we summarize the key Puppet components and give you the elements to have a broader vision. For more experienced users, we provide topics on designing, implementing, adapting, and deploying Puppet architectures. If you are an expert, you will find topics and information that is rarely exposed in other books, giving you an insight into Puppet's future and its usage on alternative devices.

LanguageEnglish
Release dateJun 27, 2016
ISBN9781785886973
Extending Puppet - Second Edition

Related to Extending Puppet - Second Edition

Related ebooks

Operating Systems For You

View More

Related articles

Reviews for Extending Puppet - Second Edition

Rating: 0 out of 5 stars
0 ratings

0 ratings0 reviews

What did you think?

Tap to rate

Review must be at least 10 words

    Book preview

    Extending Puppet - Second Edition - Alessandro Franceschi

    www.packtpub.com/authors.

    Customer support

    Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

    Errata

    Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

    To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

    Piracy

    Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

    Please contact us at <copyright@packtpub.com> with a link to the suspected pirated material.

    We appreciate your help in protecting our authors and our ability to bring you valuable content.

    Questions

    If you have a problem with any aspect of this book, you can contact us at <questions@packtpub.com>, and we will do our best to address the problem.

    Chapter 1. Puppet Essentials

    There are moments in our professional life when we meet technologies that trigger an inner wow effect. We realize there's something special in them and we start to wonder how they can be useful for our current needs and, eventually, wider projects. Puppet, for me, has been one of these turning point technologies. I have reason to think that we might share a similar feeling.

    If you are new to Puppet, you are probably starting from the wrong place, there are better fitting titles around to grasp its basic concepts.

    This book won't indulge too much on the fundamentals, but don't despair, this chapter might help for a quick start. It provides the basic Puppet background needed to understand the rest of the contents and may also offer valuable information to more experienced users.

    We are going to review the following topics:

    The Puppet ecosystem, its components, history, and the basic concepts behind configuration management

    How to install and configure Puppet commands and paths, to understand where things are placed

    The core components and concepts; terms such as manifests, resources, nodes, and classes will become familiar

    The main language elements—variables, references, resources defaults, ordering, conditionals, comparison operators, virtual and exported resources

    How Puppet stores the changes it makes and how to revert them

    The contents of this chapter are quite dense, so take your time to review and assimilate them if they sound new or look too complex; the path towards Puppet awareness is never too easy.

    The Puppet ecosystem

    Puppet is a configuration management and automation tool; we use it to install, configure, and manage components of our servers.

    Initially written in Ruby, some parts were rewritten in version 4 in Clojure. Released with an open source license (Apache 2), it can run on any Linux distribution, many other UNIX variants (Solaris, *BSD, AIX, and Mac OS X), and Windows. Its development started in 2005 by Luke Kanies as an alternative approach to the existing configuration management tools (most notably CFEngine and BladeLogic). The project has grown year after year; Kanies' own company, Reductive Labs, renamed in 2010 to Puppet Labs, has received a total funding of $ 45.5 million in various funding rounds (among the investors there are names such as VMware, Google, and Cisco).

    Now, it is one of the top 100 fastest growing companies in the US. It employs more than 150 people and it has a solid business based on open source software, consisting of consulting services, training, certifications, and Puppet Enterprise. Puppet Enterprise is the commercial version that is based on the same open source Puppet codebase, but it provides an integrated stack with lots of tools, such as a web GUI that improves and makes Puppet usage and administration easier, and more complete support for some major Linux distributions, Mac OS X, and Microsoft Windows Server.

    The Puppet ecosystem features a vibrant, large, and active community, which discusses on the Puppet Users and Puppet Developers Google groups, on the crowded free node #puppet IRC channel, at the various Puppet Camps that are held multiple times a year all over the world, and at the annual PuppetConf, which is improving and getting bigger year after year.

    Various software products are complementary to Puppet; some of them are developed by Puppet Labs:

    Hiera: This is a key-value lookup tool that is the current choice of reference for storing data related to our Puppet infrastructure.

    Mcollective: This is an orchestration framework that allows parallel execution of tasks on multiple servers. It is a separate project by Puppet Labs, which works well with Puppet.

    Facter: This is a required complementary tool; it is executed on each managed node and gathers local information in key/value pairs (facts), which are used by Puppet.

    Geppetto: This is an IDE, based on Eclipse that allows easier and assisted development of Puppet code.

    Puppet Dashboard: This is an open source web console for Puppet.

    PuppetDB: This is a powerful backend that can store all the data gathered and generated by Puppet.

    Puppet Enterprise: This is the commercial solution to manage via a web frontend Puppet, Mcollective, and PuppetDB.

    The community has produced other tools and resources. The most noticeable ones are:

    The Foreman: This is a systems lifecycle management tool that integrates perfectly with Puppet.

    PuppetBoard: This is a web front end for PuppetDB.

    Kermit: This is a web front end for Puppet and Mcollective.

    Modules: These are reusable components that allow management of any kind of application and software via Puppet.

    Why configuration management matters

    IT operations have changed drastically in the past few years. Virtualization, cloud, business needs, and emerging technologies have accelerated the pace of how systems are provisioned, configured, and managed.

    The manual setup of a growing number of operating systems is no longer a sustainable option. At the same time, in-house custom solutions to automate the installation and the management of systems cannot scale in terms of required maintenance and development efforts.

    For these reasons, configuration management tools such as Puppet, Chef, CFEngine, Rudder, Salt, and Ansible (to mention only the most known open source ones) are becoming increasingly popular in many infrastructures.

    They show infrastructure as code, that allows, in systems management, the use of some of the same best practices in software development for decades, such as maintainability, code reusability, testability, or version control.

    Once we can express the status of our infrastructure with versioned code, there are powerful benefits:

    We can reproduce our setups in a consistent way, what is executed once can be executed any time, the procedure to configure a server from scratch can be repeated without the risk of missing parts

    Our code commits log reflects the history of changes on the infrastructure; who did what, when, and if commits comments are pertinent, why.

    We can scale quickly; the configurations we made for a server can be applied to all the servers of the same kind.

    We have aligned and coherent environments; our Development, Test, QA, Staging, and Production servers can share the same setup procedures and configurations.

    With these kinds of tools, we can have a system provisioned from zero to production in a few minutes, or we can quickly propagate a configuration change over our whole infrastructure automatically.

    Their power is huge and has to be handled with care; as we can automate massive and parallelized setups and configurations of systems; we might automate distributed destructions.

    With great power comes great responsibility.

    Puppet components

    Before diving into installation and configuration details, we need to clarify and explain some Puppet terminology to get the whole picture.

    Puppet features a declarative Domain Specific Language (DSL), which expresses the desired state and properties of the managed resources.

    Resources can be any component of a system, for example, packages to install, services to start, files to manage, users to create, and also custom and specific resources, such as MySQL grants, Apache virtual hosts, and so on.

    Puppet code is written in manifests, which are simple text files with a .pp extension. Resources can be grouped in classes (do not consider them classes as in OOP, they aren't). Classes and all the files needed to define the configurations required are generally placed in modules, which are directories structured in a standard way that are supposed to manage specific applications or system's features (there are modules to manage Apache, MySQL, sudo, sysctl, networking, and so

    Enjoying the preview?
    Page 1 of 1