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:

The instructions in this topic assume that you are using a Unix-based operating system.

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

Step 1 Start XL Deploy

Follow the instructions to install XL Deploy 6.0.0 or later. Note that Java Development Kit (JDK) 8 is required.

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. Hover over Applications in the left pane, click Explorer action menu, and then select and select New > Application.
  2. In the Name box, enter PetClinicEnv.
  3. Click Save.

Step 3 Create a provisioning package

To create a new provisioning package:

  1. Expand Applications, hover over PetClinicEnv, click Explorer action menu, and then select New > Provisioning Package.
  2. In the Name box, enter 1.0.0.
  3. 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

To create a new provisionable, hover over the 1.0.0 package, click Explorer action menu, and select New > aws > InstanceSpec. 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.

Click Save to save the CI.

Sample aws.ec2.InstanceSpec CI

Create an SSH host template

Hover over the 1.0.0 package, click Explorer action menu, and select template > SshHost. 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 tab

Click Save to save the CI.

Sample template.overthere.SshHost CI

Create a Tomcat server template

Next, hover over the tomcat-host CI, click Explorer action menu, and select New > Server. 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

Click Save to save the CI.

Sample template.tomcat.Server CI

Create a Tomcat virtual host template

Next, hover over the tomcat-server CI, click Explorer action menu, and select New > VirtualHost. Enter the following properties:

Property Value Description
Name tomcat-vh The name of the CI

Click Save to save the CI.

Sample template.tomcat.VirtualHost CI

Create a directory to store generated CIs

Finally, 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 box, 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.

Sample aws.ec2.InstanceSpec with bound template

Step 6 Add a Puppet provisioner

To add Puppet as a provisioner:

  1. Hover over tomcat-instance-spec, click Explorer action menu, and select New > Manifest to create a new Puppet manifest.
  2. In the Name box, enter install-tomcat.
  3. Select tomcat-host from the Host Template list.
  4. Under Choose file, 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.

Sample puppet.provisioner.Manifest CI

Add modules to the provisioner

Add Puppet modules to the provisioner:

  1. Hover over the install-tomcat CI, click Explorer action menu, and select New > ModuleSpec.
  2. In the Name box and the Module Name box, enter puppetlabs-tomcat.
  3. Click Save.
  4. Repeat this process to create a module for puppetlabs-java.

Now, if you open the install-tomcat 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.ec2.Cloud.
  2. In the Name box, enter AWS-EC2.
  3. Enter your Amazon Web Services credentials in the Access Key ID and Secret Access Key boxes.
  4. 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. Under Containers, select Infrastructure/AWS-EC2 from the drop down list.
  4. Go to the Provisioning tab.
  5. In the Directory Path box, enter Tomcat.
  6. Click Save.

Environment with aws.ec2.Cloud added

Step 9 Perform provisioning

To provision the environment:

  1. Open the Deployment workspace.
  2. Under Packages, select PetClinicEnv and drag it to the left side of the Deployment Workspace.
  3. Under Environments, select Cloud and drag it to the right side of the Deployment Workspace.
  4. Optionally, click Preview to preview the provisioning plan.

    Provisioning plan preview

  5. Optionally, click Deployment Properties and go to the Provisioning tab. The value in the Provisioning Id field is automatically generated by XL Deploy. To prevent name collisions, this ID will be prepended to CIs that are generated from bound templates.
  6. Click Deploy to perform the provisioning.

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:

CIs generated from bound templates added to environment

Now, you can import the sample package PetClinic-war/1.0 from the XL Deploy server and deploy it to the Cloud environment. After the deployment succeeds, 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.