repacker v2.5.2
Repacker
Repacker helps you modularise and re-use packer templates. Dont repeat yourself.
Things you can do with repacker:
Re-use pre-existing open-source packer templates with your own infrastructure; Maintain libraries of provisioners/post-processors and apply them to multiple builds; Safely pull in changes from upstream without having to manually merge templates. Lots of other stuff
Install
Make sure you have nodejs and packer installed, then run
npm install -g repacker
Run
Write a Repackerfile in your packer template's directory and invoke repacker.
It will invoke packer to build the referenced templates, integrating all the transformations included in the Repackerfile.
What happens then?
Repacker does the following steps:
- Take an existing packer template from either:-
- a local file;
- a remote git repo;
- an empty file.
Apply a set of transformations to it.
- Each of the four packer template sections (variables, builders, provisioners, post-processors) can be transformed.
- The transformations applied are (in order)
- Replace a section;
- Include content in a section;
- Apply JSONPath edits
Execute packer with options
- only: run a specific builder
- vars: add variables to packer build command line.
- varfiles: add varfiles to the packer build commaind line
Move any output files to a specified location.
Get the target template
todo
Transformations
The transformations applied are as follows, in this order:-
- Replace
Replace a packer section (variables, builders, provisioners, post-processors) with a fragment from the repacker file or another json or yaml file.
- Include
Append content into a packer section with a fragment from the repacker file or another json or yaml file.
- JSONpath edit
Use standard JSONpath to edit individual settings
Execute
todo
Move
todo