Skip to content

chriswayg/packer-templates

 
 

Repository files navigation

Packer Templates

Packer templates, mainly for use building boxes for Vagrant Cloud.

Current boxes

Use existing template

Using alpine3.7 as an example:

  • cd alpine3.7
  • Edit alpine-3.7-x86_64.json
  • export VAGRANTCLOUD_USER="chriswayg" to use the correct account name.
  • export VAGRANTCLOUD_TOKEN="abcdefghijk.atlasv1..." to be able to access the account.

Test build

Note, this is a local build and will intentionally fail on the post-processor. If it didn't, it would push every build up to Vagrant Cloud, probably not what is desired when the template is being developed, updated, and/or tested.

../build.sh local
vagrant box add alpine-3.7-local output.box
mkdir test && cd test
vagrant init alpine-3.7-local
vagrant up

Note, to debug the VM boot process change headless to false in the template. Optionally, export PACKER_LOG=1 to see output from Packer.

Deploy the Vagrant Box to Vagrant Cloud

../build.sh vagrantcloud

Build environment

packer version && vagrant -v && vboxmanage --version
>>>>>>> maier-master

	Packer v1.2.3
	Vagrant 2.0.4
	5.2.12r122591

Original Readme

Packer templates, mainly for use building boxes for Vagrant Cloud.

Environment

Latest versions of: packer, vagrant, and VirtualBox

Current boxes

Use existing template

Using centos7.5.1804 as an example:

  1. cd centos7.5.1804
  2. Edit centos-7.5.1804-x86_64.json
    1. Update push.name to use the correct account name.
    2. And anything else that interests you (customize by editing anything applicable in the scripts/ or http/ subdirectories.)

To perform a local build simply run, ../build.sh local

To perform the build integrated with Vagrant Cloud run, ../build.sh vagrantcloud (Ensure that VAGRANTCLOUD_USER and VAGRANTCLOUD_TOKEN are set correctly.)

Test build

Note, this is a local build and will intentionally fail on the vagrant-cloud post-processor. If it didn't it would push every build up to Vagrant Cloud, probably not what is desired when the template is being developed, updated, and/or tested.

$ ../build.sh local

Note, to debug the VM boot process change headless to false in the template. Optionally, run PACKER_LOG=1 packer build centos-7.5.1804-x86_64.json to see additional debugging output from Packer.

Deploy to Vagrant Cloud

This will act accordingly to how the variables were set in the environment and build.conf.

$ ../build.sh vagrantcloud

Creating a new distribution/release template

  1. Create distribution specific directory structure by copying a previous release or a similar distribution. $ mkdir centos7.x.y && cp -r centos7.5.1804/* centos7.x.7/.
  2. Change to the new directory $ cd centos7.x.7
  3. Change the name of the packer configuration file mv centos-7.5.1804-x86_64.json centos-7.x.7-x86_64.json
  4. Edit the new packer configuration file for the new distro/release
  5. Edit remaining files to update for new distro/release

Note: some of the older release templates still reference the previous Atlas configurations; to build those again the template files would need to be updated to use Vagrant Cloud rather than Atlas.

Releases

No releases published

Packages

 
 
 

Languages

  • Shell 76.3%
  • Ruby 23.7%