Valid since:
XL Deploy 7.2.0

This topic provides a step-by-step example that will help you get started with the XL Deploy provisioning feature. To follow this example, you need:

Important: The instructions in this topic assume that you are using a Unix-based operating system. Important: The minimum Puppet plugin version for this tutorial is 6.0.0.

Note: A version of this topic is available for XL Deploy 5.5.x.

Step 1 - Start XL Deploy

Install XL Deploy 6.0.0 or later.
Note: Java Development Kit (JDK) 8 is required top run this application.

If XL Deploy is already installed, start the XL Deploy server.

Step 2 - Create an application

XL Deploy uses the same model for deployment packages and provisioning packages, so you must first create an application that will serve as a logical grouping of provisioning packages. A provisioning package describes the infrastructure items that should be created and the details of the environment to which infrastructure items will be associated.

To create a new application:

  1. In the left pane, hover over Applications, click Explorer action menu, and select New > Application.
  2. In the Name field, enter PetClinicEnv.
  3. Click Save.

Step 3 - Create a provisioning package

  1. Expand Applications.
  2. Hover over PetClinicEnv, click Explorer action menu, and select New > Provisioning Package.
  3. In the Name field, enter 1.0.0.
  4. Click Save.

Step 4 - Create provisionables and templates

A provisioning package consists of provisionables, which are virtual machine specifications, and templates for configuration items (CIs).

Create an instance specification

  1. Hover over the 1.0.0 package, click Explorer action menu, and select New > aws > ec2 > InstanceSpec.
  2. Enter the following properties:

| Property | Value | Description | | ——– | —– | ———– | | Name | tomcat-instance-spec | The name of the CI | | AWS AMI | Your AWS AMI ID (for example, ami-d91be1ae) | The ID of an AMI where Puppet is installed | | Region | The EC2 region of the AMI (for example, eu-west-1) | The EC2 region, which must be valid for the AMI that you selected | | AWS Security Group | default | The security group of the AMI | | Instance Type | m1.small | The size of the instance | | AWS key pair name | Your AWS key name | Name of your EC2 SSH key pair. If you do not have an AWS key name, log in to the Amazon EC2 console, create a new key, and download it to your local machine. |

  1. Click Save to save the CI.

Sample aws.ec2.InstanceSpec CI

Create an SSH host template

  1. Hover over the 1.0.0 package, click Explorer action menu, and select New > template > Overthere > SsHost.
  2. Enter the following properties:

    Property Value Description
    Name tomcat-host The name of the CI
    Operating System UNIX Operating system of the virtual machine
    Connection Type SUDO Puppet requires a SUDO connection
    Address {{%publicHostname%}} This is a placeholder that will be resolved from the provisioned
    Username ubuntu User name for the EC2 machine
    Private Key File SSH_DIRECTORY/{{%keyName%}}.pem The location of the SSH key on your local machine to use when connecting to the EC2 instance. SSH_DIRECTORY is the directory where you store your SSH keys; for example, Users/yourusername/.ssh
    SUDO username root The user name to use for SUDO operations (this property is located on the Advanced section
  3. Click Save to save the CI.

Create an SshHost host template

Create a Tomcat server template

  1. Hover over the tomcat-host CI, click Explorer action menu, and select New > Template > Tomcat > Server.
  2. Enter the following properties:
Property Value Description
Name tomcat-server The name of the CI
Home /opt/apache-tomcat Puppet will install Tomcat in this directory
Start Command sh bin/startup.sh The command that will start Tomcat
Stop Command sh bin/shutdown.sh The command that will stop Tomcat
  1. Click Save to save the CI.

Create a tomcat server template.png

Create a Tomcat virtual host template

  1. Hover over the tomcat-server CI, click Explorer action menu, and select New > template > tomcat > VirtualHost.
  2. In the Name field, enter tomcat-vh.
  3. Click Save to save the CI.

Create a directory to store generated CIs

Create a directory to store the CIs that XL Deploy will generated from the templates:

  1. Hover over Infrastructure, click Explorer action menu, and select New > Directory.
  2. In the Name field, enter Tomcat.
  3. Click Save.

Step 5 - Bind the SSH host template to the instance spec

To bind the tomcat-host template to the tomcat-instance-spec provisionable:

  1. Double-click tomcat-instance-spec to open it.
  2. Go to the Common section.
  3. Under Bound Templates, select Applications/PetClinicEnv/1.0.0/tomcat-host from the drop down list.
  4. Click Save.

Bind the SSH host template to the instance spec

Step 6 - Add a Puppet provisioner

  1. Hover over tomcat-instance-spec, click Explorer action menu, and select New > Puppet > provisioner > Manifest.
  2. In the Name field, enter install-tomcat.
  3. In the Host Template field, select tomcat-host.
  4. In the Choose file field, click Browse and upload a Puppet manifest file that will install Tomcat. You can also specify the Artifact location in File Uri field.
  5. Click Save.

Adding modules to the provisioner

Add modules to the provisioner

  1. Hover over the tomcat-instance-spec CI, click Explorer action menu, and select New > puppet > provisioner > Module.
  2. In the Name field, enter puppetlabs-tomcat.
  3. In the Host Template field, select tomcat-host.
  4. In the Module Name field, enter puppetlabs-tomcat.
  5. Click Save.
  6. Repeat steps 1 to 5 and enter puppetlabs-java for the Name and Module Name fields.

Note: If you open tomcat-instance-spec CI, you will see the modules.

Sample puppet.provisioner.Manifest CI with module specs

Step 7 Create the AWS provider

Create a new provider for Amazon Web Services (AWS):

  1. Hover over Infrastructure, click Explorer action menu, and select New > aws > aws > Cloud.
  2. In the Name field, enter AWS-EC2.
  3. In the Access Key ID field, enter your AWS ID.
  4. In the and Secret Access Key field, enter AWS access key.
  5. Click Save.

Sample aws.ec2.Cloud CI

Step 8 Create an environment

Create an environment where the package will be provisioned:

  1. Hover over Environments, click Explorer action menu, and select New > Environment.
  2. In the Name box, enter Cloud.
  3. In the Containers section, select Infrastructure/AWS-EC2 from the drop down list.
  4. In the Provisioning section, Directory Path field, enter Tomcat.
  5. Click Save.

Environment with aws.ec2.Cloud added

Step 9 Provision the enviroment

  1. Hover over 1.0.0, click Explorer action menu, and click Deploy
  2. On the Environments page, select Cloud.
  3. Click Continue.
  4. Click Preview to view the deployment plan.
  5. Click Save.
  6. Click Deploy.

Provisioning plan preview

Conclusion

You can see the generated CIs in the Repository:

Infrastructure CIs generated from bound templates

In this case, the unique provisioning ID was 695hnTMa.

You can also see that the CIs were added to the Cloud environment.

You can now import the sample package PetClinic-war/1.0 from the XL Deploy server and deploy it to the Cloud environment. When deployment is completed you can see the application running at http://<instance public IP address>:8080/petclinic. You can find the public IP address and other properties in the instance CI under the provider.