Packer templates, mainly for use building boxes for Atlas.
⁖ packer version && vagrant -v && vboxmanage --version
Packer v0.8.6
Vagrant 1.8.1
5.0.14r105127
- Alpine Linux v3.1.3 x86_64 Atlas boxes
- Alpine Linux v3.2.3 x86_64 Atlas boxes
- Alpine Linux v3.3.1 x86_64 Atlas boxes
- CentOS v6.5 x86_64 Atlas boxes
- CentOS v6.6 x86_64 Atlas boxes
- CentOS v7.1.1503 x86_64 Atlas boxes
- CentOS v7.2.1511 x86_64 Atlas boxes
Using alpine3.3.1
as an example:
cd alpine3
- Edit
alpine-3.3.1-x86_64.json
3. Updatepush.name
to use the correct Atlas account name. 4. And anything else that interests you - Edit
sh_vars
6. SetATLAS_USER_NAME
to the correct Atlas account name.
To perform a local build simply run, packer build alpine-3.3.1-x86_64.json
To perform the build integrated with Atlas run, ../atlas.sh
$ packer validate alpine-3.3.1-x86_64.json
Note, this is a local build and will intentionally fail on the atlas post-processor. If it didn't it would push every build up to Atlas, probably not what is desired when the template is being developed, updated, and/or tested.
$ packer build alpine-3.3.1-x86_64.json
Note, to debug the VM boot process change headless to false in the template. Optionally, run
PACKER_LOG=1 packer build alpine-3.3.1-x86_64.json
to see output from Packer.
This will act accordingly to how the variables were set in sh_vars
.
$ ../atlas.sh
NOTES
- When the build is created on Atlas some variables need to be set before it will work. Namely, the two
ATLAS_*
variables fromsh_vars
&../atlas.sh
. The template is expecting these to be in the environment when Atlas performs the build. But, there is a chicken-and-egg issue with regards to, the template needs to be pushed to Atlas before the build variables can be edited... There does not currently appear to be a way to create a build without pushing a template first, which then triggers a build, which then fails... As such, the first build will probably fail until theATLAS_USER_NAME
andATLAS_BOX_NAME
variables are added in the Atlas Build Configuration Variables section.- CentOS 7 uses
build_type="local"
, builds the box locally then pushes the built box up to Atlas. (versus alpine3 and centos6 which leverage remote Atlas builds.) The reason for this is, the version of virtualbox used by Atlas is older and the vbga repeatedly failed to build/install on CentOS 7...YMMV. Building the box locally with virtualbox v4.3.26 works correctly [for me].
- Create distribution specific directory structure. e.g.
$ cp -r skel <New_Distro_or_Ver>
- Change to the directory
- Edit
sh_vars
and set the required variables. - Run
../atlas.sh
once to generate a skeleton Packer template. - Edit the resulting template. Specific items which need to change are in
<<>>
(thedescription
andpush.name
primarily.) Update the rest based on the needs of the distribution and the Packer template documentation. Theiso_url
,iso_checksum
, andboot_comand
would have to be set at the barest minimum. Add any additional builders or provisioners, etc. - Create any applicable artifacts in
http
andscripts
to be used by the template.
$ packer validate <template>
Note, this is a local build and will intentionally fail on the atlas post-processor. If it didn't it would push every build up to Atlas, probably not what is desired when the template is being developed, updated, and/or tested.
$ packer build <template>
This will act accordingly to how the variables wer set in sh_vars
.
$ ../atlas.sh