Specify post-processor in command line

75 views
Skip to first unread message

John C

unread,
Apr 3, 2017, 12:35:25 PM4/3/17
to Packer
I have a Packer JSON that specifies multiple builders and multiple post-processors.  When working on new features/fixes/changes, I can specify in the command line to have Packer use only a specific builder, but all post-processors that reference the builder are used, and there doesn't seem to be a way to control that on the command-line.  As a result, the resultant template will use all post-processors which takes additional time to complete and clutters additional locations with a template that's not fully tested and ready for distribution to all locations.

Is there a way to specify a specific post-processor via the command line?  A specific use case would be ...

-- Use Packer command line to specify 'only' in command line so a specific builder is used (like building to ESX)
-- Run post-processor to build the template into a specific ESX instance (like a lab), so that the template is only built in a specific location and can be tested first

I would prefer not to create duplicate builders in the JSON as they would essentially be the same (except for post-processing), and if the builder itself needs to change, all of them need to change, which could introduce issues if they're not all updated in the same way.  Ideally this would be in the Packer command line so I could specify both the builder and post-processor to be used, then I can test first and ensure everything is working properly prior to running the post-processor in all locations.

Thanks.

Alvaro Miranda Aguilera

unread,
Apr 3, 2017, 2:05:26 PM4/3/17
to packe...@googlegroups.com
hello

the idea behind packer having multiples builders is you will end with 2 vms that are provisioned in the same way.

If you have a post-processor for virtualbox, that mean you want to run that all the time.

IF thats not the case, then you can have multiple builders

ie:

{
  "type": "virtualbox-iso",
  "name": "virtualbox1"
..
}

then a 2nd builder
{
  "type": "virtualbox-iso",
  "name": "virtualbox2"
..
}
and in the post processor you can use

only: "virtualbox1"
 or
only: "virtualbox2"

and you will have different builders.

the same applies for other builders, but this is an example.

Hope I understood your question, and this helps.

Alvaro.





--
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/3347b84d-8161-4ce7-b91f-47e9a0f32e85%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Reply all
Reply to author
Forward
0 new messages