Upload
others
View
3
Download
0
Embed Size (px)
Citation preview
Table of ContentsLab Overview - HOL-PRT-1469 - Puppet and Puppet Enterprise ........................................2
Lab Guidance .......................................................................................................... 3Module 1 - Learning More About the Puppet Enterprise with the Learning VM (45 Min) ...4
Welcome ................................................................................................................. 5Resources.............................................................................................................. 11Manifests............................................................................................................... 16
Module 2 - vCAC Puppet Enterprise Integration (45 Min) ................................................ 20Overview............................................................................................................... 21Create a Deployment Environment ....................................................................... 22Register Puppet as a Solution Instance ................................................................. 27Import Puppet Classes as Services........................................................................ 34Create Multi-tier Application using Puppet services .............................................. 40Deploy & Puppetize a Multi-tier Application Instance............................................53Conclusion............................................................................................................. 64
HOL-PRT-1469
Page 1HOL-PRT-1469
Lab Overview - HOL-PRT-1469 - Puppet and
Puppet Enterprise
HOL-PRT-1469
Page 2HOL-PRT-1469
Lab GuidanceOverview
So what is Puppet, and why should you care? At a high level, Puppet manages yourmachines' configurations. You describe your machine configurations in an easy-to- readdeclarative language, known as the Puppet DSL, and Puppet will bring your systems intothe desired state and keep them there.
Puppet Enterprise is a complete configuration management platform, with an optimizedset of components proven to work well together. It combines Puppet (including apreconfigured production-grade puppet master stack), a web console for analyzingreports and controlling your infrastructure, powerful orchestration features, cloudprovisioning tools, and professional support.
But a journey of a thousand miles starts with a single step. These modules will get youstarted with that journey. While completing these modules, imagine the possibilities inusing what you learn to manage hundreds or thousands of systems in an effortless,intuitive manner!
These modules are completely independent of each other. If you would like to jumpdirectly to Module 2 - vCAC Puppet Enterprise Integration, you can click on the linkbelow.
Module 1 - Learning More About Puppet Enterprise (30 Min)
In this module we will introduce you to the value of Puppet and Puppet Enterprise Wewill also give you the information you need to get you started on your learningadventure.
Module 2 - vCAC Puppet Enterprise Integration (45 Min)
Puppet Enterprise enables IT teams to automate VM lifecycle management and scaleservices quickly, reliably, and efficiently. In this lab you will walk through using servicesdefined by Puppet modules in conjunction with vCAC blueprints, to deploy a multitierapplication managed by Puppet.
HOL-PRT-1469
Page 3HOL-PRT-1469
Module 1 - Learning MoreAbout the Puppet
Enterprise with theLearning VM (45 Min)
HOL-PRT-1469
Page 4HOL-PRT-1469
WelcomeQuest Objectives
• Learn about the value of Puppet and Puppet Enterprise
• Familiarize yourself with the Quest structure and tool
The Puppet Enterprise Learning Virtual Machine
In this module, we will provide an overview of the Puppet Enterprise Learning VirtualMachine including working with the Quest Tool, Resources, and Manifest in the PuppetEnterprise Learning Virtual Machine.
What is Puppet?
So what is Puppet, and why should you care? At a high level, Puppet manages yourmachines' configurations. You describe your machine configurations in an easy-to- readdeclarative language, known as the Puppet DSL, and Puppet will bring your systems intothe desired state and keep them there.
Puppet Enterprise is a complete configuration management platform, with an optimizedset of components proven to work well together. It combines Puppet (including apreconfigured production-grade puppet master stack), a web console for analyzingreports and controlling your infrastructure, powerful orchestration features, cloudprovisioning tools, and professional support.
It may seem a lot easier to "just run a command" to effect a change in configuration, orperhaps writing a script that executes a series of commands looks like a more effectiveway to manage the configuration of a system. This is true, as long as you're onlyconcerned about a single change, or changes to a single system. The true power ofPuppet is that it allows you to describe all the details of the configuration for multiplemachines in a composable manner, and allows you to manage the configuration ofmultiple machines (think hundreds or thousands) without having to write complicatedscripts that are hard to comprehend; or maintaining an inventory of all your systems,and logging in to each system in turn to run the required commands or scripts. Puppetautomates the process of configuring your systems and keeping them configuredexactly as you need them to be.
But a journey of a thousand miles starts with a single step. This Learning VM will get youstarted by means of examples that help you configure the VM. While doing theexercises, imagine the possibilities in using what you learn to manage hundreds orthousands of systems in an effortless, intuitive manner!
HOL-PRT-1469
Page 5HOL-PRT-1469
Connect to the Puppet Enterprise Learning Virtual Machine
For this lab, we will be using Putty to connect the the Learning VM
Start Putty
We will use Putty to SSH to the VM. We do this for convenience and it's essential for youto get the most out of the Learning VM and this Quest Guide.
Click on Start>Putty
HOL-PRT-1469
Page 6HOL-PRT-1469
SSH to the Learning VM
Enter "192.168.110.109" in the Host Name or IP address text box and then clickOpen
Respond to the Security Alert
Click Yes to move past the Security Alert
HOL-PRT-1469
Page 7HOL-PRT-1469
Login to the Learning VM
Use the credentials below to log in to the Learning VM via SSH:
username: root
password: puppet
Once you're logged in, feel free to take a look around. You will see the Learning VM isfairly typical of a Unix-based operating system. You should be aware though, that someservices are running in the background, including the SSH service you're using to accessthis Learning VM from your own terminal.
We should give you a heads up; since you're logged in to the root account, which isgarnished by the uid => 0, you carry the mark of a Superuser. Your account gives youthe ability to change just about anything you would like in this Learning VM, just as youwould if you were tasked with administrating a machine.
By following this Quest Guide, you will learn how Puppet allows you to use theseprivileges easily and effectively.
The Quest Tool
To monitor your status as you progress through these Quests, we've created a quest toolyou can use in the Learning VM. However, this quest tool is not part of Puppet itself. Wehave included this tool in the Learning VM to provide you with real-time feedback as youprogress through the many Quests and Tasks on your journey to learn Puppet.
What is a Quest?
Up to this point we've introduced you to the Learning VM and Puppet. We'll continue todive into greater detail about Puppet in future quests. Wait a minute! What's a quest?That's a great question! A Quest is a structured tutorial consisting of a number ofinteractive tasks that will help you learn about a topic related to Puppet.
HOL-PRT-1469
Page 8HOL-PRT-1469
Each Quest includes a number of Tasks that give you a hands-on opportunity to applywhat you have learned. You have already finished a task by now, since the first task wasto execute the puppet -V command earlier. But how do you keep track of everything asyou progress? What if you forget what quest you are on? These are all great questionsand that's why we specifically created a 'Quest Tool' for this Learning VM to help youwhen you're in need.
Determining the Puppet Enterprise Version
Before we dig any deeper, let's check and see what version of Puppet Enterprise
we are running on this Learning VM. Type the following command:
puppet -V # That's a capital 'V'
You will see the following response:
3.4.3 (Puppet Enterprise 3.2.2)
This indicates that Puppet Enterprise 3.2.2 is installed on the Learning VM, whichleverages Puppet version 3.4.3. Puppet Enterprise includes more than 40 open sourceprojects, including Puppet, MCollective, PuppetDB, Hiera, and others that we’veintegrated, certified, performance-tuned, and security-hardened to make it a completesolution suitable for automating mission-critical enterprise infrastructure. In addition, itincludes several capabilities found only in Puppet Enterprise, including event inspection,supported modules, role-based access control, certification management and VMwarecloud provisioning.
Accessing Quest Help
To explore the command options for the quest tool, type the following command:
quest --help
The quest --help command provides you with a list of all the options for the questcommand. You can invoke the quest command with each of those options,
such as:
quest --progressquest --completed
HOL-PRT-1469
Page 9HOL-PRT-1469
quest --listquest --start <name>
Checking Your Progress
Let's find out how much progress you have made thus far! Execute the followingcommand:
quest --progress
Using the quest tool is entirely optional, but we have also integrated it into the first fewquests to help you out if needed.
In addition to the quest command line tool, we have also integrated real-time feedbackinto the VM, which is displayed in the bottom-right corner of the terminal, as seen inFigure 1.
Review
In this introductory quest we provided a very high level explanation of what Puppet is,what a quest is, and how to use the quest tool. As you progressed through this quest,you learned about the mechanics of successfully completing a quest by means ofcompleting the associated tasks. We hope you have a general understanding of how tocomplete a quest and what is in store for you on your learning journey.
HOL-PRT-1469
Page 10HOL-PRT-1469
ResourcesQuest Objectives
• Understand how resources on the system are modeled in Puppet's Domain SpecificLanguage (DSL)
• Learn about the Resource Abstraction Layer (RAL)
• Use Puppet to inspect resources on your system
Getting Started
In this quest, you will be introduced to Resources and how system configurations arerepresented using Resource definitions. You will learn how to inspect resources on theLearning VM using Puppet. Please note though, that we are not going to use Puppet tomanage any resources. Instead, we are going to use basic Unix commands in this quest,and then look at how the resultant resource changes are represented in Puppet'sDomain Specific Language (DSL). As an aspiring practitioner of Puppet, it is importantfor you to have a thorough understanding of the Puppet syntax as well as the puppetresource and puppet describe tools. When you're ready to get started, type thefollowing command:
quest --start resources
Resources
Resources are the fundamental units for modeling system configurations. Each resourcedescribes some aspect of a system, like a service that must be running or a packagethat must be installed. The block of Puppet code that describes a resource is called aresource declaration. Resource declarations are written in Puppet's own DomainSpecific Language.
Puppet's Domain Specific Language
Puppet uses its own configuration language, one that was designed to be accessible anddoes not require much formal programming experience. The code you see below is anexample of what we're referring to. Since it is a declarative language, the definitions ofresources can be considered as models of the state of resources.
type {'title': attribute => 'value',}
HOL-PRT-1469
Page 11HOL-PRT-1469
You will not be using resource declarations to shape your environment just yet. Instead,you will exercise your power by hand and use Puppet only to inspect your actions usingthe puppet resource and puppet describe tools.
Anatomy of a Resource
Resources can be large or small, simple or complex. In the world of Puppet, you andeverything around you (on the Learning VM) are resources. But let's say you wanted tolearn more about a particular resource. How would one do that? Well, you have twooptions: puppet describe and puppet resource .
Task 1
Let's say you want to learn more about the user resource type as it applies to all
users in the Learning VM. You would need to type the following command:
puppet describe user
The puppet describe command can list info about the currently installed resource typeson a given machine.
Task 2
Great! But how would one look at a specific resource? Well, to check and see how youlook in the world of Puppet, type the following command :
puppet resource user root
The block of code below that describes you as the root user is called a resourcedeclaration. It's a little abstract, but a nice portrait, don't you think?
user { 'root': ensure => 'present', comment => 'root', gid => '0', home => '/root', password => '$1$jrm5tnjw$h8JJ9mCZLmJvIxvDLjw1M/', password_max_age => '99999', password_min_age => '0', shell => '/bin/bash', uid => '0',}
The puppet resource can interactively inspect and modify resources on a single systemas well as can be useful for one-off jobs. However, Puppet was born for greater thingswhich we'll discuss further in the Manifest Quest.
Resource Type
Let's take a look at your first line in the above resource declaration. Do you see the worduser ? It's right before the curly brace. This is called the resource type. Just as anyindividual cat or dog is a member of its species (Felis catus and Canus lupis familiaris tobe precise) any instance of a resource must be a member of a resource type. Think of
HOL-PRT-1469
Page 12HOL-PRT-1469
this type as a framework that defines the range of characteristics an individual resourcecan have.
Puppet allows you to describe and manipulate a variety of resource types. Below aresome core resource types you will encounter most often:
• userA user• groupA user group• fileA specific file• packageA software package• serviceA running service• cronA scheduled cron job• execAn external command• hostA host entry
Resource Title
Again, let's take a look at your first line in the above resource declaration. Do you seethe single quoted word 'root' ? It's right after the curly brace. This is called the title. Thetitle of a resource is used to identify it and must be unique. No two resources of thesame type can share the same title. Also, don't forget to always add a colon (:) after thetitle. That's important to remember and often overlooked!
Attribute Value Pairs
One more time. Let's look at the resource declaration for user root listed above. Afterthe colon (:) comes a list of attributes and their corresponding values. Each lineconsists of an attribute name, a => (which we call a hash rocket), a value, and a finalcomma. For example, the attribute value pair home => '/root', indicates that your homeis set to the directory /root .
Task 3
The path to greatness is a lonely one. Fortunately, your superuser status gives you theability to create a sidekick for yourself. First let's do this in a non-Puppet way. Type thefollowing command:
useradd byte
Task 4
Now take a look at Byte using the puppet resource tool. Type the following
command:
HOL-PRT-1469
Page 13HOL-PRT-1469
puppet resource user byte
Potent stuff. Note that Byte's password attribute is set to '!!' . This isn't a properpassword at all! In fact, it's a special value indicating Byte has no password whatsoever.
Task 5
Let's rectify Byte's password situation by setting it to puppetlabs. Type the followingcommand:
passwd byte
Now set the password to puppetlabs and pressing Enter (Return) twice. You will not seeanything displayed as you type the password.
Now if you take another look at Byte using puppet resource , the value for Byte'spassword attribute should now be set to a SHA1 hash of the password, something a littlelike this: '$1$hNahKZqJ$9ul/RR2U.9ITZlKcMbOqJ.'
Task 6
Now have a look at Byte's home directory, which was set to '/home/byte' by default.Directories are a special kind of file, and so Puppet knows of them as File resources. Thetitle of any file is, by default, the same as the path to that file. Let's find out more aboutthe tools directory where our sidekick can store tools. Enter the command:
puppet resource file /home/byte/tools
Task 7
What? ensure => 'absent', ? Values of the ensure attribute indicate the basic state of aresource. A value of absent means something doesn't exist at all. We need to make adirectory for Byte to store tools in:
mkdir /home/byte/tools
Now have another look at Byte's tools directory:
puppet resource file /home/byte/tools
Task 8
We want Byte to be the owner of the tools directory. To do this, type the following
commands:
HOL-PRT-1469
Page 14HOL-PRT-1469
chown -R byte:byte /home/byte/tools
Inspect the state of the directory one more time, to make sure everything is in order:
puppet resource file /home/byte/tools
The Resource Abstraction Layer
By now, we have seen some examples of how Puppet 'sees' resources on the system. Acommon pattern you might observe is that these are descriptions of how the resource inquestion should or does look like. In subsequent quests, we will see how, instead of justinspecting existing resource, we can declare how specific resource should look like,providing us the ability to model the state of these resources.
Puppet provides us this ability to describe resources of different types of resources. Eachtype is a high-level model of the resource. Our job in defining how a system should beconfigured is reduced to one of creating a high-level model of the desired state of thesystem. We don't need to worry about how that is achieved.
Puppet takes the descriptions expressed by resource declarations and uses providersthat are specific to the Operating System to realize them. These Providers abstract awaythe complexity of managing diverse implementations of resource types on differentsystems. As a whole, this system of resource types and the providers that implementthem is called the Resource Abstraction Layer, or RAL.
You can describe the ideal state of a user resource. Puppet will choose a suitableprovider to realize your definition - in the case of users, Puppet can use providers tomanage user records in /etc/passwd files or NetInfo, or LDAP. Similarly, when you wishto install a package, you can stand back and watch Puppet figure out whether to useyum or apt for package management. This lets you ignore the implementation detailswith managing the resources, such as the names of the commands (is it adduser oruseradd?) the arguments for the commands, file formats etc and lets you focus on themore important job of modeling the desired state for your systems.
By harnessing the power of the RAL, you can be confident of the potency of your Puppetskills wherever your journey takes you.
Review
Let's rehash what we learned in this quest. First, we learned two very important Puppettopics: the Resource Abstraction Layer and the anatomy of a resource. To dive deeperinto these two important topics, we showed you how to use the
puppet describe and puppet resource tools, which also leads us to a betterunderstanding Puppet's Language. These tools will be tremendously useful to you in thesucceeding quests. Unfortunately we didn't get to write any Puppet code in this quest,but that's okay. We're going to start doing that in the Manifest Quest (the next quest)!
HOL-PRT-1469
Page 15HOL-PRT-1469
ManifestsQuest Objectives
• Understand the concept of a Puppet manifest
• Construct and apply manifests to manage resources
Getting Started
As you saw in the Resources Quest, Puppet's resource declarations can be used to keeptrack of just about anything in this Learning VM. So far, you have made changes to theLearning VM without using Puppet. You looked at resource declarations using puppetdescribe and puppet resource only in order to track your effects. In this quest, you willlearn to craft your own resource declarations and inscribe them in a special file called amanifest. When you're ready to get started, type the following command:
quest --start manifest
Puppet Manifests
Manifests are files containing Puppet code. They are standard text files saved with the.pp file extension. The core of the Puppet language is the resource declaration as itdescribes a desired state for one resource. Puppet manifests contain resourcedeclarations. Manifests, like the resource declarations they contain, are written inPuppet Language.
Let's get started by making sure you're in your home directory: /root. This is where youwant to place newly created manifests.
cd /root
Task 1
Create a manifest to remove user byte:
Unfortunately byte just doesn't seem to be working out as a sidekick. Let's create amanifest to get rid of byte. We will create a manifest, with some code in it. Type thefollowing command, after you make sure you are in the /root directory as mentionedabove:
nano byte.pp
Type the following instructions into Byte's manifest:
HOL-PRT-1469
Page 16HOL-PRT-1469
user { 'byte': ensure => 'absent',}
Save the file and exit your text editor. We touched on this in the Resources Quests, butthe ensure => absent attribute/value pair states that we are going to make sure userbyte does not exist in the Learning VM.
Puppet Parser
What if we made an error when writing our Puppet code? The puppet parser tool isPuppet's version of a syntax checker. When provided with a file as an argument, thistool validates the syntax of the code in the file without acting on the definitions anddeclarations within. If no manifest files are provided, Puppet will validate the defaultsite.pp manifest. If there are no syntax errors, Puppet will return nothing when thiscommand is ran, otherwise Puppet will display the first syntax error encountered.
Task 2
Using the puppet parser tool, let's you check your manifest for any syntax errors.
Type the following command:
puppet parser validate byte.pp
Again, if the parser returns nothing, continue on. If not, make the necessary changesand re-validate until the syntax checks out.
Puppet Apply
Once you've created a manifest you will use the puppet apply tool to enforce it. Thepuppet apply tool enables you to apply individual manifests locally. In the real world,you may want an easier method to apply multiple definitions across multiple systemsfrom a central source. We will get there when we talk about classes and modules insuceeding quests. For now, manifests and puppet apply aid in learning the Puppetlanguage in small, iterative steps.
When you run puppet apply with a manifest file as the argument, a catalog is generatedcontaining a list of all resources in the manifest, along with the desired state youspecified. Puppet will check each resource in your environment against the resourcedeclaration in the manifest. Puppet's providers will then do everything necessary tobring the state of those resources in line with the resource declarations in yourmanifest.
HOL-PRT-1469
Page 17HOL-PRT-1469
Task 3
Once your byte.pp manifest is error free, we're going to simulate the change in theLearning VM without actually enforcing those changes. Let's see what happens:
puppet apply --noop byte.pp
In the returned output, Puppet tells us that it has not made the changes to the LearningVM, but if it had, this is what would be changed.
Task 4
Since the simulated change is what we want, let's enforce the change on the LearningVM.
puppet apply byte.pp
How is byte doing?
puppet resource user byte
byte does not seem to be doing well. Actually, the user's gone. The ensure => 'absent'value clearly made short work of the user account.
Task 6
With Puppet manifests you can create as well as destroy. Lets create a new, strongersidekick by adding user gigabyte to the Learning VM using Puppet. If you need help onhow to do this, refer to the previous tasks you've just completed in this quest. One thingto note: ensure => 'present' will make sure GigaByte exists in the Learning VM.
The steps include creating a manifest file, and writing the minimal amount of Puppetcode required to ensure that the user account is created. This task will be markedcomplete when the user exists on the system.
Review
This is a foundational quest you must understand in order to successfully use Puppet. Asyou saw when completing this quest, we've added two new tools to your toolbox:puppet parser and puppet apply . You always want to use puppet parser to check thesyntax of your manifest before using puppet apply to enforce it. This quest contained awalkthrough of the "best practice" methods to creating, checking, applying yourmanifest. We've also created a simplified version below for your reference:
1. Open or create a manifest with the .pp extension2. Add or edit your Puppet code
HOL-PRT-1469
Page 18HOL-PRT-1469
3. Use the puppet parser tool to check for syntax errors (recommended)4. Simulate your manifest using puppet apply --noop (recommended)5. Enforce your manifest using puppet apply6. Check to make sure everything is working correctly (recommended)
HOL-PRT-1469
Page 19HOL-PRT-1469
Module 2 - vCAC PuppetEnterprise Integration (45
Min)
HOL-PRT-1469
Page 20HOL-PRT-1469
OverviewPuppet Enterprise enables IT teams to automate VM lifecycle management and scaleservices quickly, reliably, and efficiently. In this lab you will walk through using servicesdefined by Puppet modules in conjunction with vCAC blueprints, to deploy a multitierapplication managed by Puppet.
Scenario
Rainpole IT is providing Cloud and IaaS for internal departments. The Accounting grouphas requested that IT quickly deploy multitier accounting applications for testing withother internal application. Rainpole IT admins will be expected to have great depth ofvisibility and control surrounding the virtual infrastructure, deploying applications/vmsdynamically and know the state of the multitier applications at all times. The Accountinggroup will often request IT to manage the lifecycle of the accounting applications at allstages from development to production.
vCloud Application Director 6.0 will be used to provision and deploy virtual machinesfrom OS templates while Puppet Enterprise is used to define configuration, enablingcontinuous configuration management and visiblity.
For this Hands-on-lab, a simple Wordpress deployment has been modeled in Puppet andwill stand in for a generic multi-tier application requested by the Accounting group.
HOL-PRT-1469
Page 21HOL-PRT-1469
Create a Deployment EnvironmentPuppet Enterprise integrates into the vFabric Application Director (AppD) component ofvCAC 6.0. At the start of the lab both vCAC and Puppet Enterprise are deployed andready to use, but have not yet been connected. This article walks through how to set upthe integration.
To integrate Application Director with Puppet Enterprise, a Deployment Environment isrequired. To create a Deployment Environment, use the Application Director GUI.
Launch Firefox
Launch Firefox from the Quick Launch bar.
HOL-PRT-1469
Page 22HOL-PRT-1469
Login to Application Director
Navigate to the Application Director 6.0 web GUI using the link provided in thenavigation bar. Login using the following credentials.
Username: adminPassword: HOLVMware1!
HOL-PRT-1469
Page 23HOL-PRT-1469
Navigate to Deployment Environments
Select "Deployment Environments" from the AppD navigation menu.
HOL-PRT-1469
Page 24HOL-PRT-1469
Create a New Deployment Environment
Press either of the "New" buttons visible on the screen to create a new DeploymentEnvironment. Since there are currently no Deployment Environments available, thecenter of the screen contains a large green "Create a Deployment Environment" link.
Name and Save the Deployment Environment
Name the new Deployment Environment "HOL", select "vCAC 6.0" as the Cloud Provider,and press Save.
HOL-PRT-1469
Page 25HOL-PRT-1469
Proceed To Next Steps
There are two actions that need to be taken in preparation for the next section of thislab. First, Puppet Enterprise must be registered as a solution instance in this deploymentenvironment and second, Puppet Classes must be imported as services into VMwarevCloud Application Director.
HOL-PRT-1469
Page 26HOL-PRT-1469
Register Puppet as a Solution InstanceThe Puppet Enterprise master must be registered with vCloud Application Director 6.0 asa solution instance within a deployment environment. This can be accomplished fromthe command line on the Puppet Enterprise master instance.
Launch PuTTY
PuTTY is available from the Start menu.
HOL-PRT-1469
Page 27HOL-PRT-1469
Connect to Puppet Enterprise Master
The Puppet Enterprise master resolvable name is puppet.corp.local.
HOL-PRT-1469
Page 28HOL-PRT-1469
Login as Root
username: rootpassword: VMware1!
Retrieve Registration Script
vCloud Application Director 6.0 serves a Ruby configuration script that simplifies thesetup needed to configure Puppet Enterprise for the integration. Retrieve this scriptusing curl on the Puppet master. The command is:
curl -O http://appd-l-01a.corp.local/artifacts/solutions/puppet/RegisterWithAppD.rb
HOL-PRT-1469
Page 29HOL-PRT-1469
Run Registration Script
Run the script with the following options. To see the full list of options the script accepts,and their descriptions, you may optionally run the script with the -h flag.
/opt/puppet/bin/ruby RegisterWithAppD.rb -i appd-l-01a.corp.local -u admin -p 'HOLVMware1!' -d HOL
Specific notes:
• Use single-quotes to specify the password• The -d flag refers to the deployment environment created in an earlier step
The full command and its expected output is shown in the screenshot.
Verify Registration
In the Application Director web GUI, navigate back to Deployment Environments andreview the HOL deployment environment. The "puppet" solution instance should now beconfigured.
Click on the puppet solution instance to view and edit its details.
HOL-PRT-1469
Page 30HOL-PRT-1469
Note: you might need to refresh the interface in order for the new Solution Instance toappear.
Edit The Solution Instance
Out of the box the vCAC Puppet solution instance won't know where to get a local copyof the Puppet Enterprise installer to use when deploying agent systems.
Click the Edit button.
HOL-PRT-1469
Page 31HOL-PRT-1469
Set the Installer Payload Base Path
In the Agents section, set the value of the installer payload base path to an appropriateresource. For the hands-on-lab, we have staged a copy of the installer on the Puppetmaster.
Set the variable:
name: pe_installer_payload_base_pathvalue: http://puppet.corp.local/packages
HOL-PRT-1469
Page 32HOL-PRT-1469
Save the Solution Instance
After saving the solution instance with the changes to thepe_installer_payload_base_path variable, the solution instance is ready.
HOL-PRT-1469
Page 33HOL-PRT-1469
Import Puppet Classes as ServicesPuppet Enterprise classes must be imported to vCloud Application Director 6.0 in orderto use them in blueprints. This can be accomplished from the command line on thePuppet Enterprise master instance.
Launch PuTTY
PuTTY is available from the Start menu.
HOL-PRT-1469
Page 34HOL-PRT-1469
Connect to Puppet Enterprise Master
The Puppet Enterprise master resolvable name is puppet.corp.local.
HOL-PRT-1469
Page 35HOL-PRT-1469
Login as Root
username: rootpassword: VMware1!
Retrieve the Application Director CLI
The vCloud Application Director 6.0 CLI is required to import Puppet classes. Retrievethe CLI using curl on the Puppet master. The command is:
curl -O http://appd-l-01a.corp.local/tools/darwin-cli.jar
Launch the CLI
Use the Java binary provided by Puppet Enterprise to run the Application Director CLI.
/opt/puppet/bin/java -jar darwin-cli.jar
HOL-PRT-1469
Page 36HOL-PRT-1469
Connect to Application Director
Login to the vCloud Application Director 6.0 instance using the "login" command. Youmay optionally specify a password flag using --password. If you omit the --password flag,you will be prompted for it.
login --serverUrl https://appd-l-01a.corp.local:8443/darwin --username admin
username: adminpassword: HOLVMware1!
Import Puppet "ntp" Class
For this Hands-on-lab, the puppetlabs/ntp module has been installed, providingconfiguration for the ntp service. The Puppet class is named "ntp". The class can beimported to vCloud Application Director 6.0 using the following CLI command.
import-puppet-manifests --puppetPath /opt/puppet/bin/puppet --typeFilter "^ntp$"
HOL-PRT-1469
Page 37HOL-PRT-1469
Import Puppet Multi-tier App Classes
Also for this Hands-on lab, two classes have been created representing configuration foran app tier system, and configuration for a database tier system. These classes are:
• rainpole::wordpress::app• rainpole::wordpress::db
These classes can be imported into vCloud Application Director 6.0 using the followingcommand - the typeFilter argument accepts a regular expression for matching availablePuppet classes.
import-puppet-manifests --puppetPath /opt/puppet/bin/puppet --typeFilter "^rainpole::wordpress"
HOL-PRT-1469
Page 38HOL-PRT-1469
Verify Import
The output of the CLI should already indicate import success. This can be visuallyverified by navigating to Services in the Application Director web GUI and searching for"puppet". Several Puppet services should be available, including ntp and the two newRainpole services.
HOL-PRT-1469
Page 39HOL-PRT-1469
Create Multi-tier Application usingPuppet servicesPuppet services can be used in blueprints exactly the same way as any other service.
Launch Firefox
Launch Firefox from the Quick Launch bar.
HOL-PRT-1469
Page 40HOL-PRT-1469
Login to Application Director
Navigate to the Application Director 6.0 web GUI using the link provided in thenavigation bar. Login using the following credentials.
Username: adminPassword: HOLVMware1!
HOL-PRT-1469
Page 41HOL-PRT-1469
Navigate to Applications
Applications is the default landing screen after login, but in the event that you are onanother page you can navigate to Applications using the drop-down menu at the top ofthe interface.
Create a New Application
Press the New drop-down button next to the orange Applications title at the upper left ofthe interface, and select Create New Application.
HOL-PRT-1469
Page 42HOL-PRT-1469
Name the Application
Type "Rainpole Multi-tier App" into the name field and press Save.
Create an Application Version
Press the New button next to the green Application Versions title.
HOL-PRT-1469
Page 43HOL-PRT-1469
Save the Application Version
Accept the default version 1.0.0 and press Save.
Create a Blueprint
Now that the application exists and has an initial version, we can create a blueprint forit. Press the Create Blueprint button.
HOL-PRT-1469
Page 44HOL-PRT-1469
Add VM Templates
Click and drag two CentOS63 64bit v1.0.0 templates into the center of the blueprint.
Note: it is important to use this template specifically, as no other logical templateshave been fully configured in the Hands-on-lab environment.
HOL-PRT-1469
Page 45HOL-PRT-1469
Customize Templates
Name each template and set the memory size to 512MB (necessary due to resourcerestrictions in the Hands-on-lab environment).
First TemplateName: wpappMemory: 512MB
Second TemplateName: wpdbMemory: 512MB
HOL-PRT-1469
Page 46HOL-PRT-1469
Add NTP Puppet Service
In the Services list on the right-hand side of the interface, search for "Puppet". This willdisplay the four Puppet services imported and available in Application Director. Drag thePuppet ntp v3.0.3 service onto both virtual machine templates.
Add App Puppet Service
Drag the Puppet rainpole wordpress app v1.0.0 service onto the wpapp virtual machinetemplate.
HOL-PRT-1469
Page 47HOL-PRT-1469
Add DB Puppet Service
Drag the Puppet rainpole wordpress db v1.0.0 service onto the wpdb virtual machinetemplate.
HOL-PRT-1469
Page 48HOL-PRT-1469
Create Dependencies
Use the blueprint to specify dependency requirements between the different applicationcomponents. For each dependency:
1. Click the Add Relation button (looks like a chain-link) in the upper right corner ofthe interface.
2. Click the first component to select it.3. Click to select the component on which the first depends.4. Repeat steps 1-3 for additional dependencies.
Dependencies:
• On the wpapp template, the App Puppet service depends on the NTP Puppetservice.
• On the wpdb template, the DB Puppet service depends on the NTP Puppetservice.
• Between the templates, the App Puppet service depends on the DB Puppetservice.
See the image for a visualization of the final dependencies required.
HOL-PRT-1469
Page 49HOL-PRT-1469
Open App Properties
Each service has a set of configurable parameters. The App connection information onthe wpapp template (database name, username, password) should be bound to thedatabase name, username and password that are being configured on the wpdb node.
Click the Puppet_rainpole_wordpress_app_v1.0 service, and switch from the Details viewto the Properties view.
Configure App Properties
To edit a property:
1. Click the edit button to the right of the property details (looks like a pencil).2. Select the radio button next to the "bind to another property in this blueprint"
drop-down menu.3. Select the property to bind to from the drop-down menu.4. Press the "save" button.
Bind the db_name, db_password, db_user and db_host properties.
• Bind db_name to wpdb:Puppet_rainpole_wordpress_db_v1.0:db_name.
HOL-PRT-1469
Page 50HOL-PRT-1469
• Bind db_password to wpdb:Puppet_rainpole_wordpress_db_v1.0:db_password.• Bind db_user to wpdb:Puppet_rainpole_wordpress_db_v1.0:db_user.• Bind db_host to wpdb:ip.
HOL-PRT-1469
Page 51HOL-PRT-1469
Save Blueprint
Press the "save" button in the upper right of the blueprint interface.
HOL-PRT-1469
Page 52HOL-PRT-1469
Deploy & Puppetize a Multi-tierApplication InstanceThe Rainpole Multi-tier App application, created previously, is ready to deploy. Thissection walks through deploying an application instance.
Select The Application
In Application Director, navigate to the Applications page, search for "Rainpole", andselect the Rainpole Multi-tier App.
Review The Blueprint
Click the blueprint button to review the blueprint one last time before deploying.
HOL-PRT-1469
Page 53HOL-PRT-1469
Press Deploy
Click the deploy button in the upper right corner of the blueprint interface.
Create A Deployment Profile
If this is the first time deploying the application, you will be prompted to create a newdeployment profile. Type "HOL" and press Deploy.
HOL-PRT-1469
Page 54HOL-PRT-1469
Map Deployment Environment Details
With the HOL deployment environment selected, press the Map Details button, thenpress Next.
HOL-PRT-1469
Page 55HOL-PRT-1469
Review Application Properties
For each node and service in the deployment, you will have the opportunity to adjustcomponent properties. If you are interested, you can review the Puppet componentproperties by clicking on the Service tab.
When ready, proceed to the next step by pressing Next.
HOL-PRT-1469
Page 56HOL-PRT-1469
Review Execution Plan
Application Director will present a visual execution plan for your review.
When ready, proceed to the next step by pressing Next.
HOL-PRT-1469
Page 57HOL-PRT-1469
Deploy The Application
Press Deploy in the lower right corner to initiate the deployment process.
HOL-PRT-1469
Page 58HOL-PRT-1469
Wait For Deployment To Complete
It will take a few minutes for the deployment to complete. While you're waiting, you cankeep an eye on the progress by expanding the execution plan window and observingactivity.
HOL-PRT-1469
Page 59HOL-PRT-1469
Determine Application IP Address
Once the deployment is complete, the IP address for the wpapp virtual machine will bedisplayed in the VM Details pane. Note what that IP address is. In the example imagebelow, the IP address is 192.168.110.108.
HOL-PRT-1469
Page 60HOL-PRT-1469
Review Application
In Firefox, navigate to the IP address discovered in the previous step. You should bepresented with the Wordpress install page, demonstrating that the application on thewpapp virtual machine has been installed and configured to connect to the database onthe wpdb virtual machine.
HOL-PRT-1469
Page 61HOL-PRT-1469
Login To The Puppet Enterprise Console
Puppet Enterprise was used to configure and provide ongoing configurationmanagement for the example multi-tier application. Using the Puppet EnterpriseConsole, we can review the current configuration status of the systems. Puppet will runand report on whether or not the systems were found to be in compliance with thedesired configuration state every 30 minutes by default.
In Firefox, navigate to https://puppet.corp.local. (If necessary, accept the self-signedcertificate). Login using the credentials below.
Username: [email protected]: VMware1!
HOL-PRT-1469
Page 62HOL-PRT-1469
Review Configuration Status
The Puppet Enterprise Console will show upon login a dashboard view indicating nodesunder management which have recently checked in with the master. Click on either thenode name for the wpapp node or the latest report link to review the Puppet informationabout either the wpapp or the wpdb nodes.
HOL-PRT-1469
Page 63HOL-PRT-1469
Conclusion
Puppet Enterprise enables IT teams to automate VM lifecycle management and scaleservices quickly, reliably, and efficiently. Combining Puppet Enterprise with vCACApplication Director allows you to leverage the language and powerful continuousconfiguration management capabilities of Puppet from the cloud management layer.
Takeaways
Thank you for taking the Puppet Labs HOL. If you would like more information, feel freeto visit http://puppetlabs.com. The Learning VM can be downloaded fromhttps://puppetlabs.com/download-learning-vm.
Don't forget to raise your virtual hand to receive your free gift from Puppet Labs.
HOL-PRT-1469
Page 64HOL-PRT-1469
ConclusionThank you for participating in the VMware Hands-on Labs. Be sure to visithttp://hol.vmware.com/ to continue your lab experience online.
Lab SKU: HOL-PRT-1469
Version: 20150226-113801
HOL-PRT-1469
Page 65HOL-PRT-1469