Since there might be considerable difference when using different
distributions another alternative is to put each builder+dist in its own
file and provisioners in another and then use some tool (python, jq, sed,
etc) to create the final template from these files.

// Rickard

On Fri, Oct 19, 2018 at 11:47 AM Alvaro Miranda Aguilera <[email protected]>
wrote:

> Hello
>
> you can put into variables all the info for ubuntu into
>
> ubuntu.json
>
> and all the debian into
>
> debian.json
>
> then use
>
> packer build -var-file ubuntu.json template.json
>
>
> if you need to use this on the provisioner, say you got different chef
> playbooks, you could use then
>
>
> {
>   "variables": {
>     "build_name": "",
>     ..
>   },
>   },
>   "builders": [
>     {
>       "name": "{{ user `build_name` }}",
>       ..
>       "type": "virtualbox-iso"
>     }
>   ],
>   "provisioners": [
>     {
>       "only": "ubuntu"
>       ...
>     }
>   ],
>   "provisioners": [
>     {
>       "only": "debian"
>       ..
>     }
>   ]
> }
>
> just add a variable to each json and the template for build_name
>
> hope 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/packer-tool/CAHqq0ey4kqch6vu79GUKhmy9smo%2BXPNbzfUc83dKqnHDDxEC6A%40mail.gmail.com
> <https://groups.google.com/d/msgid/packer-tool/CAHqq0ey4kqch6vu79GUKhmy9smo%2BXPNbzfUc83dKqnHDDxEC6A%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/CALz9Rt9bnuB54PBLPCfa1%2B1VLZVBd7wTLq6aDR%3DQcbcX%3DcBD8g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to