Puppet Enterprise 2016.4

Note: Before you author applications for use with application orchestration, we recommend you have hands-on experience writing Puppet code. You should also be familiar with Puppet modules.

Although Puppet application orchestration can help you manage any distributed set of infrastructure, it’s primarily designed to configure an application stack. The simple application stack used in the following extended example comprises a database server on one machine and a web server that connects to the database on another machine.

With previous Puppet coding techniques, you’d write classes and defined types to define the configuration for these services, and you’d pass in class parameter data to tell the web server class how to connect to the database. With application orchestration, you can write Puppet code so this information can be exchanged automatically. And when you run Puppet, the services will be configured in the correct order, rather than repeatedly until convergence.

Application orchestration workflow

The following diagrams illustrate the major steps in the application orchestration workflow—from authoring your application to configuring it with the Puppet orchestrator.

Step 1: Create the application definition and its parts

Create service resources and application components

In the applications you compose, application components share information with each other by exporting and consuming environment-wide service resources.

First, in this example, called lamp, we create the Sql service resource in lamp/lib/puppet/type/sql.rb.

Step 1, continues with create the service resource (Click to enlarge)

An application component is an independent bit of Puppet code that can be used alongside one or more other components to create an application. Components are often defined types that consist of traditional Puppet resources that describe the configuration of the component (file, package, and service, for example).

Next, the database component is defined in lamp/manifests/db.pp.

Step 1, create the database component (Click to enlarge)

The produces statement, contained in lamp/manifests/db.pp expresses that the Lamp::Db component produces the Sql service resource. The produces statement is included outside of the defined type.

Step 1, continues with create the produces statement (Click to enlarge)

Create the application definition

The application definition (or model) is where you connect all the pieces together. It describes the relationship between the application components and the exchanged service resources. As it shares the name of the module, it is in lamp/manifests/init.pp.

Step 1, continues with create the application definition (Click to enlarge)

Step 2: Instantiate your application

The application instance is where you create a unique version of your application and specify which nodes to use for each component.

Step 2, create the application instance (Click to enlarge)

Step 3: Use the orchestrator commands to run Puppet and configure your application

  • puppet app show shows the details of your application instances.

  • puppet job run runs Puppet across all the nodes in the order specified in your application instance.

  • puppet job list shows running and completed Orchestration jobs.

Step 3, use the orchestrator to run Puppet and configure your application
(Click to enlarge)

At the start of a job run, the orchestrator prints a Job Plan that shows what’s included in the run and the expected node run priority. The nodes are grouped by depth. Nodes in level 0 have no dependencies and will run first. Nodes in the levels below are dependent on nodes in higher levels.

Step 3, continues with the job plan output
(Click to enlarge)

As your job progresses, the orchestrator will print results of each node run after it completes. A “Success!” message prints when all jobs complete.

Step 3, continues with the results of each job (Click to enlarge)

Back to top