To manage agents with Puppet, you first need to install puppet on them. Install the Puppet agent and learn about its certificate-based security.
- [Instructor] Now that you've got your roles, and profiles ready it's time to start managing some nodes. You could start up additional Vms, but since this is just for learning you can use the docker agent module to spin up some simulated puppet nodes. This module is just for educational purposes. It installs docker on the master, and deploys a couple of containers that behave like separate nodes. To install the module add the module itself, and its dependencies to your puppet file. So we'll click Puppet File, and click the pencil to edit, mod pltraining dockeragent.
This module also depends on the garethr docker module. The third dependency is puppet labs concat, but because we've already listed that we don't need to enter it again. Scroll down, and commit your changes. We'll create a node called web.puppet.vm, and another called db.puppet.vm by adding some resource declarations for our master. First we'll create a profile class in site profile agent notes. Let's go to site, click on the profile directory, and then go to manifests.
This'll happen automatically in github because this is the only directory, and then we're going to create a new file. The name of the file is agent_nodes.pp. In this file we'll type class profile colon colon agent_nodes, an opening curly brace, and then we'll include dockeragent, and we'll have two node declarations. We'll say dockeragent colon colon node, web.puppet.vm and our closed curly brace.
And then an identical line, but this time db.puppet.vm. And then we'll want the closed curly brace for the class. We'll go down here, and click commit. Now we'll need to add that profile to the master server role. We'll go back to site, and then click on role/manifests, and open up the master server. Click the pencil, and here we'll type include profile colon colon agent_nodes, and commit our change.
Since we've already added that role to the master in site.pp that should be all that's needed. Once that's merged to production you can hop over to your master, deploy the code, and run puppet. Let's do that now. We'll deploy our code with r10k deploy environment -p, and then puppet agent -t to run puppet. This will run for awhile because it needs to download the CentOS based docker container, and set up the images for the docker agent module.
Once that's complete you should have a simulated environment with two nodes ready to go.
- What is Puppet?
- Setting up a Puppet master and control repo
- Using the built-in resource types
- Organizing code with roles and profiles
- Managing more nodes
- Triggering actions (orchestration)
- Gathering system info with facter
- Writing modules
- Using templates