cancel
Showing results for 
Search instead for 
Did you mean: 
cancel

Packer Integration

483
Views
0
Helpful
0
Comments

Introduction


Packer is an open source tool for creating identical machine images for multiple platforms from a single source configuration. Packer is lightweight, runs on every major operating system, and is highly performant, creating machine images for multiple platforms in parallel. 


Using the CloudCenter platform we can directly use packer to create AMIs in AWS and add the image mapping to CloudCenter to be used by various application profiles. This helps with image management in the public cloud using CloudCenter. Note in this example, during image mapping we will leave the mapping of the instance types empty. Once the images are mapped, the user will have to edit the mapping to choose the right instance type they would like to make available for this image.


The service highlights how we can use packer to create a Centos image in AWS.  This script is an example usage of Packer. You can leverage this integration to create more advance deployments.

Prerequisites


CloudCenter

  • CloudCenter 4.8.x and above
  • CloudCenter Orchestrator running on AWS


Service Package Bundle


The Packer Service bundle consists of the following files:

  • service - The main script that has the logic for the integration
  • serviceDictionary.csv - The dictionary CSV file that has the list of all the parameters and their defaults. If you want to get addition input from the user, they need to be added to this file and also in the UI. The format of this file is as follows:
    • DisplayName,paramName,paramType,defaultValue,visible,optional
    • e.g. Root Volume Size,root_volume_size,10,Y,N

      The parameter name is key here and should match the parameter name in the UI

  • packer-builder-amazon-ebs - The amazon-ebs Packer builder is able to create Amazon AMIs backed by EBS volumes for use in EC2

Service Description


When using Packer we need to provide parameters for the template that is used to build the image. This example integration provides a sample template to create a Centos image. Users can modify these parameters and create their own templates based on their use case


To add this service login to CloudCenter as an administrator and click on Admin->Services->Add Service. Use the information listed below to create the service.


Service Type: External Service

Name: Packer

Service ID: packerbuild

Description: Packer is an open source tool for creating identical machine images for multiple platforms from a single source configuration.

Category: Custom Service


External Lifecycle Actions:


External Action Bundle: <location of packerbuild.zip>


Start:

     Script from Bundle: service start


Service Parameters

Parameter NamePACKER_ZIP_URL
Display NamePACKER ZIP URL
Typestring
Default Valuehttps://releases.hashicorp.com/packer/1.1.3/packer_1.1.3_linux_amd64.zip
User Options

Parameter Nameapi_user
Display Name     CloudCenter API User
Typestring
Default Valuecliqradmin
User Options

Parameter Nameapi_key
Display NameCloudCenter API Key
Typestring
Default Value
User Options

Parameter Nameccm_url
Display NameCloudCenter CCM URL
Typestring
Default Value<your ccm ip>
User Options


Deployment Parameters

Parameter Nameami_name
Display NameAMI Name                  
Typestring
Default Value
User OptionsVisible, Editable

Parameter Namesource_ami
Display Name      Source AMI                 
Typestring
Default Value
User OptionsVisible, Editable


Parameter Namesubnet_id
Display NameSubnet ID                 
Typestring
Default Value
User OptionsVisible, Editable


Parameter Namevpc_id
Display NameVPC ID                      
Typestring
Default Value
User OptionsVisible, Editable


Parameter Nameinstance_type
Display Name           Instance Type                   
Typestring
Default Value
User OptionsVisible, Editable


Parameter Namessh_username
Display Name           SSH Username                  
Typestring
Default Value
User OptionsVisible, Editable


Parameter Namevirtualization
Display Name        Virtualization               
Typestring
Default Value
User OptionsVisible, Editable


Parameter Nameroot_volume_size
Display Name              Root Volume Size                 
Typestring
Default Value10
User OptionsVisible, Editable


Parameter Namelog_volume_size
Display Name            Log Volume Size                 
Typestring
Default Value10
User OptionsVisible, Editable



Parameter Nameregion
Display Name       AWS Region                 
Typestring
Default Value
User OptionsVisible, Editable

Parameter Nametemplate_url
Display Name                     Packer Template Location               
Typepath
Default Value
User OptionsVisible, Editable


Parameter Nameprovisioner_script_url
Display Name           Provisioner Script Location
Typepath
Default Value
User OptionsVisible, Editable

Parameter Nameimage_name
Display Name                      CloudCenter Image Name                 
Typestring
Default Value
User OptionsVisible, Editable


Parameter Nameimage_desc
Display Name                CloudCenter Image Description
Typestring
Default Value
User OptionsVisible, Editable

Parameter Nameos_type
Display Name            CloudCenter Image OS Type
Typelist
List ValuesLINUX,WINDOW
Default ValueLINUX
User OptionsVisible, Editable

Downloads


CreatePlease to create content
Content for Community-Ad
August's Community Spotlight Awards
This widget could not be displayed.