Multiple builders using a common shared image source...?

27 views
Skip to first unread message

Kevin Peirce

unread,
Feb 11, 2019, 8:29:03 AM2/11/19
to Packer
Hi,

Apologies if this has been asked in a different guise - I have some quite a lot of searching (both on this message board and on the internet in general - sometimes it's all about the search phrase!).

Basically, I have the requirement to build multiple VMs (configured all the same way using the same Provisioners) but outputting in different VM formats - e.g. VMWare and Openstack.

The "problem" is I want to use a single common source VM in each builder (such as a "qcow2" image) - but each builder likes to have its own personal source that is already in the native format of the image being output.  E.g. The VMWare builder needs a vmware image, the docker builder needs a docker image, etc, etc.

The only thing I can think of is to use a script that invokes something like "qemu-img" to spit out a couple of specific VM image types, that are then magically used by the "builder" blocks in the Packer JSON script.

Is there a "pre-builder" block that I've missed that could do this?  Or have I simply missed something in the general Packer docs?

Any pointers would be awesome - even if it's just agreeing with my "only thing..." idea above.

Thanks in advance,

Kevin Peirce


Justin DynamicD

unread,
Feb 13, 2019, 4:58:46 PM2/13/19
to Packer
So the entire point of Packer is to build those custom images on each platform so you can reliably deploy VMs and have them largely be the same.  it does not deploy VMs ... it creates images.

From your description it seems like you are trying to use it as a tool to deploy servers .... that's what Terraform is for, another tool by Hashicorp.

Packer:  creates like images across platforms in a repeatable fashion with as much common code as possible.
Terraform: deploys servers from images in a repeatable fashion using as much common code as possible.
Reply all
Reply to author
Forward
0 new messages