Chapter 12. Putting it all together

Manhood is patience. Mastery is nine times patience.

—Ursula K. Le Guin, 'A Wizard of Earthsea'

In this chapter, we will apply ideas from all the previous chapters to see what a complete, working Puppet infrastructure looks like, using a demonstration repo that illustrates all the principles explained in this book. You can use it as the basis of your own Puppet code base, adapting and expanding it as needed.

Putting it all together

Getting the demo repo

The demo repo is available on GitHub, and you can clone it, in the same way as for the example repo for this book, by running this command:

git clone https://github.com/bitfield/control-repo

The demo repo contains everything you'll need to manage nodes with Puppet:

  • User accounts and SSH keys
  • SSH and sudoers config
  • Time zone and NTP settings
  • Hiera data
  • Automatic Puppet update and apply scripts
  • Bootstrap script for new nodes

A Vagrantfile is also included, so you can try out the repo on a Vagrant VM.

Copying the repo

If you are going to use the demo repo as a basis for your own Puppet repo, you need to make a copy of it so that you can edit and maintain it yourself.

You can do this in two ways. One is to fork the repo to your own GitHub account. To do this, log in to GitHub and browse to the demo repo URL:

https://github.com/bitfield/control-repo.git

Look for the Fork button at the top right-hand side of the page and click it. This will create a new repo under your account, which contains all the code and history from the demo repo.

Alternatively, you can follow these steps:

  1. Create a new repo in your GitHub account (name it puppet, or control-repo, or whatever you prefer).
  2. Make a note of the repo URL.
  3. Clone the demo repo to your personal machine:
    git clone https://github.com/bitfield/control-repo
    cd control-repo
    
  4. Rename the original repository remote (so you can get updates in the future):
    git remote rename origin upstream
    
  5. Add your new repo as the origin remote (using the URL for your repo that you noted earlier):
    git remote add origin YOUR_GIT_URL
    
  6. Push to the new remote:
    git push origin production
    

Your repo now contains a complete copy of the demo repo, which you can edit and customize as you like.

As the original repo is updated in the future, you will be able to pull these changes into your own version. To get changes from upstream, run the following commands:

git fetch upstream
git rebase upstream/production
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.217.58