Contribute to jbl/devsoft development by creating an account on GitHub. Chef Infrastructure Automation Cookbook, Second Edition. This book takes you through covering the various artifacts of Chef and explains the techniques of. For systems administrators and developers this book could revolutionize your cloud and server infrastructure through automation. Packed with.
|Language:||English, Spanish, German|
|Genre:||Science & Research|
|Distribution:||Free* [*Register to download]|
Chef provides a framework for fully automating infrastructure, and has some .. declared in cookbook metadata, similar to packaging system. Infrastructure Automation with Chef. Speaker: Classic infrastructure & operations are major efforts to run. 14 . Chef Cookbook Examples. CouchDB. Java. Register Free To Download Files | File Name: Chef Infrastructure Automation Cookbook PDF. CHEF INFRASTRUCTURE AUTOMATION COOKBOOK.
For instance, if you were to configure Apache https as a proxy for a farm of Tomcat instances, your configuration could ask the Chef server for a list of all the installations of Tomcat, their hostnames, and port number.
Common Terminology The following are some Chef terms that will be helpful to know before we start. Node: A managed machine. When the Chef client runs, it executes the configuration for a node.
In most cases, every machine you manage will be represented by: a a client for logging into the API and b a node configuration to apply. Administrators and the web interface are also clients. Cookbook: A collection of attributes, recipes, custom resources, and definitions to configure a certain application or service.
Recipe: A list of resources that should be applied to a node. Recipes are written in normal Ruby extended by the Chef resource domain-specific language. This gives you the power of anything you can do in Ruby conditionals, using gems, etc. It allows you to pass a set of cookbooks either in a local directory or in a tar ball on a server and a JSON file to configure your system.
While this is the simplest thing that could possibly work, you give up the ability to search for other nodes or look up items in data bags to configure your nodes. Local Chef Server Setting up your own Chef server has been streamlined by a cookbook provided by Opscode. The cookbook can set up the Chef server on Ubuntu 8. Hosted Chef Hosted Chef is a service provided by Opscode, the makers of Chef, which frees you from configuring your own Chef server. Section 2 Components of Chef When using Chef as a client-server application, either with a local Chef server or the Hosted Chef, there are a few moving parts to keep track of.
Knife Knife is the tool you will use as a system administrator to interact with the server most often, especially taking cookbooks and other custom configurations and loading them into the server for distribution to clients.
You can also bootstrap new servers with the Chef client components, start new instances on the major cloud providers AWS, Rackspace, SliceHost, and Terremark , and search for nodes or other data. Running knife --help will give you a list of supported commands. Chef Client The Chef client runs on the servers you are managing.
Your managed nodes, knife, and the web interface are all clients of the API. While you will probably not need to access the API directly, it is good to know that all of your data and more advanced automation are available using the API. Section 3 Ohai Knowing the current state of your machine is a big part of any configuration management system. Ohai is a Ruby library that gathers information about your system and formats it as JSON for use by the Chef client and for storage on the Chef server.
To see for yourself, type ohai at the command prompt. This information is exposed in your recipes through the node object. Ohai also allows you to write custom plug-ins for your specific environment or equipment. This is a key difference from some other configuration management tools, which attempt to have you define the relationship between every resource.
While both approaches have their strengths and weaknesses, the ordered run list is easiest for most people to understand.
As of 0. Section 5 Cookbooks Anatomy of a Cookbook When you run knife cookbook create [NAME], a new directory structure is created with some sane defaults for your new cookbook.
Most of the directories will be addressed in later sections, but there are two files created in the top-level directory for your cookbook that are important.
It provides critical information about the name, version, dependencies, and other properties of the cookbook. The main pieces that influence thechef clientt behavior as of 0. The version field is important with the introduction of environments in 0. It allows you to pin an environment to a specific version of a cookbook.
This way your production environment can remain on a tested version of your configuration while you are improving your development version. Versions have to be managed by hand right now. When you use knife to upload a cookbook to the Chef server it will replace any files or recipes it finds that were uploaded with the same version number. You can prevent yourself and others from overwriting a given version of a cookbook by passing knife the --freeze flag.
The depends property specifies what other cookbooks are required on the client for this cookbook to work. The second depends clause in the example includes a version number. This is optional but will allow you to keep major changes to your cookbooks from breaking others if you manage your version numbers well.
Borrowing and Sharing Cookbooks One of the greatest assets of any open-source project is the way the community shares knowledge.
Much of the community uses Git as version control for their Chef repository, so knife provides the knife cookbook site install command that downloads the cookbook and places it in a vendor branch within your Git repository and then merges it into the master branch.
This allows local modifications to persist even if you upgrade the underlying cookbook. For those who use Subversion or other version control system, you can use the knife cookbook site download command to bring down atar balll that you can unpack where you wish.
Likewise you may spend hours building a cookbook and want to share it with the community.
Please do! You can either make a tgz file of your cookbooks directory or use the knife cookbook site share command to upload it to the community site. When you develop an interesting cookbook, consider sharing it with the community.
Also consider placing the source on GitHub or a similar public service so that others can contribute. You can override a file in this default directory with a version that is host specific, OS and version specific, or just OS specific. The utility versus the complexity of the file specificity system is in discussion in the community at the moment. There are clearer ways to specify template and file resources like in the resource itself , so I caution users to not make heavy use of this functionality.
It is more likely to confuse those that come after you. Behind each resource are one or more providers that tell Chef how to execute the actions you require against a certain type of system. For instance, the package resource has providers for yum, apt, gems, and more.
Log The Log resource is the simplest resource there is. All it does is print a logging message at the level you provide defaulting to INFO. INFO: This is a message from chef You can specify the level you want the message to be logged at with the level parameter. These multiple providers allow the single package resource to be used on most major UNIX-based operating systems. The node object includes all the data discovered by the Ohai application.
After describing how to use the basic Chef tools, the book shows you how to troubleshoot your work and explains the Chef language. Then, it shows you how to manage users, applications, and your whole cloud infrastructure.
The book concludes by providing you additional, indispensable tools and giving you an in-depth look into the Chef ecosystem. Chef Infrastructure Automation Cookbook will help you learn the techniques of the pros by walking you through a host of step-by-step guides to solve real-world infrastructure automation challenges.
Matthias Marschall is a Software Engineer "made in Germany". His four children make sure that he feels comfortable in lively environments, and stays in control of chaotic situations. A lean and agile engineering lead, he's passionate about continuous delivery, infrastructure automation, and all things DevOps.
In recent years, Matthias has helped build several web-based businesses, first with Java and then with Ruby on Rails. He quickly grew into system administration, writing his own configuration management tool before migrating his whole infrastructure to Chef in its early days. In , he started a blog http: There, they have shared their ideas about DevOps since the early days of the continually emerging movement. You can find him on Twitter as mmarschall.
Matthias holds a Master's degree in Computer Science Dipl. When not writing or coding, Matthias enjoys drawing cartoons and playing Go. He lives near Munich, Germany. Sign up to our emails for regular updates, bespoke offers, exclusive discounts and great free content.
Log in. My Account. Log in to your account. Not yet a member? Register for an account and access leading-edge content on emerging technologies.
Register now. Packt Logo.
My Collection. Deal of the Day Efficiently deploy and manage Kubernetes clusters on a cloud. Sign up here to get these deals straight to your inbox. Find Ebooks and Videos by Technology Android. Packt Hub Technology news, analysis, and tutorials from Packt. Insights Tutorials.
News Become a contributor. Categories Web development Programming Data Security.
Subscription Go to Subscription. Subtotal 0. Title added to cart. Subscription About Subscription Pricing Login. Features Free Trial.
Search for eBooks and Videos. Chef Infrastructure Automation Cookbook. For systems administrators and developers this book could revolutionize your cloud and server infrastructure through automation. Are you sure you want to claim this product using a token? Matthias Marschall August Quick links: What do I get with a Packt subscription? What do I get with an eBook? What do I get with a Video?
Frequently bought together. Learn more Add to cart. Continuous Delivery and DevOps: A Quickstart guide. Paperback pages. Book Description Irrespective of whether you're a systems administrator or a developer, if you're sick and tired of repetitive manual work and not knowing whether you may dare to reboot your server, it's time for you to get your infrastructure automated.
Table of Contents Chapter 1: Chef Infrastructure. Downloading and integrating cookbooks as vendor branches into your Git repository. Changing organizations based on the current Git branch. Chapter 2: Evaluating and Troubleshooting Cookbooks and Chef Runs. Overriding a node's run list to execute a single recipe. Chapter 3: Chef Language and Style. Extending community cookbooks by using application wrapper cookbooks. Chapter 4: Writing Better Cookbooks. Finding the complete list of operating systems you can use in cookbooks.