Use provisioning outputs in templates

In Deploy, a provisioning package is a collection of:

  • Provisionables: These contain settings that are needed to provision a cloud-based environment.
  • Provisioners: These execute actions in the environment after it is set up.
  • Templates: These create configuration items (CIs) in Deploy during the provisioning process.

When you map a provisioning package to an environment, Deploy creates provisioneds. These are the actual properties, manifests, scripts, and so on. Deploy will use these to provision the environment.

If you use a provisioned property such as the IP address or host name of a provisioned server in a template, the property will not have a value until provisioning is done. You can use contextual placeholders for these types of properties. Contextual placeholders can be used for all properties of provisioneds. The format for contextual placeholders is {{% ... %}}.

You can also use contextual placeholders for output properties of some CI types. Deploy automatically populates output property values after provisioning is complete. Example: After you provision an Amazon Elastic Compute Cloud (EC2) AMI, the aws.ec2.Instance configuration item (CI) will contain its instance ID, public IP address, and public host name. For information about properties, see the AWS Plugin Reference.

Sample provisioning output usage

To provision an Amazon EC2 AMI and apply a Puppet manifest to it, you qill require a host for the Puppet manifest. To obtain the host address, the AMI must be provisioned using a contextual placeholder:

  1. In the top bar, Click Explorer.
  2. Expand Applications, then expand the application.
  3. Hover over the application, click Menu button and select New > aws > ec2 > InstanceSpec.
  4. In the Name field, enter EC2-Instance-Spec
  5. Fill in the required fields and save the CI.

    Create new provisionable (aws.ec2.InstanceSpec)

  6. Hover over the application, click menu button and select New > template > overthere > SshHost.
  7. In the Name field, enter tomcat-host.
  8. Fill in the required properties, setting the Address property to {{%publicHostname%}}.
  9. Click Save.

    Sample template.overthere.SshHost with contextual placeholder

  10. Double-click the package.
  11. Under Provisioning, click the Bound Templates field, and add tomcat-host to the list.

    Note: This ensures that Deploy will save the generated overthere.SshHost CI in the Repository.

    Sample package with bound template

  12. Hover over EC2-Instance-Spec, click Menu button, and select New > puppet > provisioner > Manifest.
  13. In the Name field, enter Puppet-provisioner-Manifest.
  14. In the Host Template field, select the tomcat-host CI that you created.
  15. Fill in the required properties.
  16. Click Save.

    Creating a puppet manifest

  17. Double-click an environment that contains an Amazon EC2 provider.
  18. Under the Provisioning section, click the Directory Path field, and enter the directory where you want to save the generated overthere.SshHost CI.

    Directory path property on a sample provider

    Note: The directory must already exist under Infrastructure.

  19. Provision the package to an environment that contains an Amazon EC2 provider.

    Note: During provisioning, Deploy will create an SSH host, using the public host name of the provisioned AMI as its address.