Puppet Labs: Automating with Puppet: Initial setup

Datetime:2016-08-23 03:28:29          Topic:          Share

Editor's Note: This post is a taste of what you'll get in our ebook about about automating routine IT tasks with Puppet, The Top 5 Things to Automate with Puppet Right Now . Download it for free to read the rest.

As you manage more and more with Puppet, and add more contributors to the Puppet code base, you’ll want to manage scale and complexity for yourself and your team. You can do this by taking advantage of a Puppet control repository.

The control repository holds all the information needed to construct a Puppet environment. We’ve combined all the hard-won best practices for managing Puppet infrastructures into the example control repository below.

The following instructions will show you how to implement these best practices on Day One, so your Puppet Enterprise deployment can scale as rapidly as you need it to.

If you’ve already set up a control repository for your installation, you can safely skip this step.

  1. Fork the Puppet example control repo into your own GitHub account.

  2. Create a Puppet Enterprise master .

  3. Create a user for yourself .

  4. Set your password .

  5. Add your new user to the Administrators group .

  6. Enable code manager and point the r10k_remote at the repository that you forked in Step 1. Remember, if you are using https to connect to Git, you don't need a private key.

  7. Run Puppet at the command line using puppet agent -t .

  8. Get a token from the RBAC service so we can run commands that require authentication by running puppet-access login [username] --service-url https://<HOSTNAME OF PUPPET ENTERPRISE CONSOLE>:4433/rbac-api --lifetime 1y .

  9. Synchronize your code by running puppet code deploy production --wait .

Deploy your code

In order to make changes to your Puppet code you will need need to do the following things:

  • Make the changes locally.
  • Push those changes to GitHub.
  • Pull those changes down to the Puppet master.

Although you can circumvent this by editing code directly on the Puppet master, it's much easier to collaborate if you are using this process.

Once you have made changes to your Puppet code and pushed those changes to GitHub, you should do the following to get it onto the master:

  1. Add and commit your changes to Git using git add and git commit .

  2. Push those changes to GitHub using git push .

  3. Pull the new code down onto the master using puppet code deploy production --wait (on the Puppet master).

If you think this is tedious, then justautomate it.

Now you’re ready to start automating with Puppet! Watch this space for the rest of our series to learn about other common processes you can automate with Puppet.

Dylan Ratcliffe is a professional services engineer at Puppet.