AWS automation with adding eula and vAppSettings with packer

57 views
Skip to first unread message

Steven Langlois

unread,
Feb 12, 2018, 11:02:29 AM2/12/18
to Packer
I would like to be able to automate AMI's of our daily build using the same technique as in the page: http://work.haufegroup.io/automate-ami-with-packer/. Essentially, use VMware to create a VM from a kickstart file but the format must be ova and then use post-processing to have packer move the VM to AWS as an AMI.

In my current build process I create the VMware VM and use the ovftool to add eula and vappsettings and convert to an ova using the following: 

    # Convert the ESX vmx file to an ovf file so the Product, Version, Vendor, etc can be added
    ovftool -tt=ovf --eula@=/opt/IBM/cmdBuild/workspace/enms/ranger_license.txt $VMDIR/$VMDIR.vmx $VMDIR/$VMDIR_ovf
    if [ $? -ne 0 ]; then
        echo "VM build failed: Failed to convert the $VMDIR vmx to an ovf file"
        success=FALSE
        break
    fi

    # Insert the vAppSettings.txt file into the ovf file just created
    sed -n -i -e '/  <\/VirtualSystem>/r /opt/IBM/cmdBuild/workspace/ranger/nightly_builds/vAppSettings.txt' -e 1x -e '2,${x;p}' -e '${x;p}' $VMDIR/$VMDIR_ovf/$VMDIR/$VMDIR.ovf

    # Convert the ovf file just created to an ova file after adding in the Product, Version, Vendor, etc. info
    ovftool -tt=ova --skipManifestCheck $VMDIR/$VMDIR_ovf/$VMDIR/$VMDIR.ovf $VMDIR/
    if [ $? -ne 0 ]; then
        echo "VM build failed: Failed to convert the $VMDIR vmx to an ova file"
        success=FALSE
        break
    fi



However, I would like to be able to add eula and vAppSettings to the VMware VM but I cannot find how to do it with packer. Therefore, my question is, is it possible to add an eula and vAppSettings using packer?

More generally, is it possible to add command line options to packer for when it calls ovftool. Right now if I specify "format": "ova" in my json file, packer calls of ovf tool as follows:

vmware-iso: Executing: ovftool --noSSLVerify=true --skipManifestCheck -tt=ova vi://root:****@emtesx/ZoneRanger ZoneRanger

But can I add or control what command line options are used with ovftool?

Thank you.

Megan Marsh

unread,
Feb 12, 2018, 11:42:06 AM2/12/18
to packe...@googlegroups.com
I think you may be looking for the "ovftool_options" feature: https://www.packer.io/docs/builders/vmware-iso.html#ovftool_options

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/2f1009ba-20b8-4521-9f0e-7424c278830d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Steven Langlois

unread,
Feb 12, 2018, 12:32:01 PM2/12/18
to Packer
Thanks Megan. I'll give that a try for adding the eula but I still can't find a solution for the VM description information such as the version, product name, vendor information. Right now I am using sed to insert the follwoing information into the ovf file before I convert it to an ova file.

    <ProductSection ovf:required="false">
      <Info>VM ISV branding information</Info>
      <Product>Amce Rocket</Product>
      <Vendor>Amce Rocket Co.</Vendor>
      <!--
            Version is the actual product version in the
            form X.X.X.X where X is an unsigned 16-bit integer.

            FullVersion is a descriptive version string
            including, for example, alpha or beta designations
            and other release criteria.
        -->
      <Version>6.0.0.0</Version>
      <FullVersion>6.0</FullVersion>
      <ProductUrl/>
      <VendorUrl>http://www.acmerocket.com/</VendorUrl>
      <AppUrl/>
      <Category>Application</Category>
    </ProductSection>
    <AnnotationSection>
      <Info/>
      <Annotation>Acme Rocket 6.0</Annotation>
    </AnnotationSection>

Alvaro Miranda Aguilera

unread,
Feb 13, 2018, 6:21:03 AM2/13/18
to packe...@googlegroups.com
Hello

You can use ovftool from VMWare


Metadata inclusion. Additional metadata, such as an end-user license agreement, can be packaged with the OVF and displayed before installation

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Steven Langlois

unread,
Feb 13, 2018, 2:01:14 PM2/13/18
to Packer
Thank Alvaro, that's what I have been doing but I wanted to use the method on this webpage:


to create an ami which requires formatting the VM as an ova file. That means adding a post-processor as shown in the page above but the metadata would need to be added before packer does the post-processing.

Is there a way I can run a script that does what I need have then have packer produce the ova from the result.

Right now, in a script I do the following to insert the metadata into the ovf file and then use ovftool to create the ova myself.

    # Insert the vAppSettings.txt file into the ovf file just created
    sed -n -i -e '/  <\/VirtualSystem>/r /opt/IBM/cmdBuild/workspace/ranger/nightly_builds/vAppSettings.txt' -e 1x -e '2,${x;p}' -e '${x;p}' $VMDIR/$VMDIR_ovf/$VMDIR/$VMDIR.ovf

    # Convert the ovf file just created to an ova file after adding in the Product, Version, Vendor, etc. info
    ovftool -tt=ova --skipManifestCheck $VMDIR/$VMDIR_ovf/$VMDIR/$VMDIR.ovf $VMDIR/
    if [ $? -ne 0 ]; then
        echo "VM build failed: Failed to convert the $VMDIR vmx to an ova file"
        success=FALSE
        break
    fi


I can figure out how to get the ova I am current building to AWS but I was hoping to have packer do it.

Alvaro Miranda Aguilera

unread,
Feb 14, 2018, 6:09:33 AM2/14/18
to packe...@googlegroups.com
there is a post-processor shell that you can use to run those commands.




--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Reply all
Reply to author
Forward
0 new messages