Book Image

Infrastructure as Code (IAC) Cookbook

By : Stephane Jourdan, Pierre Pomès
Book Image

Infrastructure as Code (IAC) Cookbook

By: Stephane Jourdan, Pierre Pomès

Overview of this book

Para 1: Infrastructure as code is transforming the way we solve infrastructural challenges. This book will show you how to make managing servers in the cloud faster, easier and more effective than ever before. With over 90 practical recipes for success, make the very most out of IAC.
Table of Contents (18 chapters)
Infrastructure as Code (IAC) Cookbook
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
Index

Automatically bootstrapping a Chef client and a Puppet agent


The first thing we want to do when working with Chef is to get the Chef client actually bootstrapped on the targeted remote server. For the Chef client to be able to apply Chef code, it first needs to be configured and registered on the Chef server. Thankfully, this can be very easily done.

Getting ready

To work through this recipe, you will need the following:

  • A remote server, with a user with SSH access

  • A working Chef DK installation on the workstation

How to do it…

Let's say we already have a server running somewhere available with a user. The minimal command line we can build is as follows:

  • The IP or FQDN of the host we want to configure (1.2.3.4)

  • The name under which to register the node on the Chef server (my_node_hostname)

  • The username to use to connect to the server (sudoer if not root).

Navigate to the Chef repository on your workstation:

$ cd chef-repo

Now let's remotely install the Chef client on the remote host from your workstation...