Packer build scripts for master, training, student, or learning VMs. See versioned release notes at ReleaseNotes.md.
- Install virtualbox, packer, and vmware ovftool and ensure the binaries are in the path.
- Run setup script to download and deploy base images:
setup.sh
- Run packer to build educationbase VM.
packer build -var-file=templates/learning.json templates/educationbase.json
- Run packer to complete VM build, the
--force
will replace any previous build artifacts.
packer build --force -var-file=templates/learning.json templates/educationbuild.json
For the master or training VMs, use master.json
or training.json
.
For the student VM, you don't need an educationbase or var-file:
packer build templates/student.json
Packer scripts are provided in the templates
directory. These depend on
packer (>= v0.10.0), vmware fusion, and ovftool. The packer builds pull
directly from github and the master branch, so changes will need to be checked in.
The base VMs are the published puppetlabs vagrant boxes. To download and
prepare them, run setup.sh
. This will create the output, file_cache, and
packer_cache directories if they don't exist.
The file_cache directory has a subfolder called "installers" for holding PE installer tarballs and another called gems for caching gems, the setup script will create any necessary directories if they don't exist. If you'd like to keep those on a separate volume to save disk space, create symlinks before running the setup script.
The packer_cache directory is used by packer to store iso's for
The common configuration options for the training, learning, and master vms have been set up in educationbase.json and vm specific variables are set in VMNAME.json
After the base VM is provisioned according to the settings in VMNAME.json, the bootstrap can be applied using educationbuild.json.
First create a base VM without any bootstrap applied:
packer build -var-file=templates/learning.json templates/educationbase.json
To initiate a packer build of the learning vm on the base vm:
packer build -var-file=templates/learning.json templates/educationbuild.json
For the training vm follow the same two steps but with training.json:
packer build -var-file=templates/training.json templates/educationbase.json
packer build -var-file=templates/training.json templates/educationbuild.json
The Student VM is the only VM running Centos6 so it's build template is all in student.json:
packer build templates/student.json
There are also several AMI builds in templates. These don't require a base build. To build these, set up the AWS builder requirements as described in the packer documentation and use the following command:
packer build -var-file=templates/learning.json templates/awsbuild.json
There is a Vagrantfile that automates this process and builds on the puppetlabs/centos-7.2-x86_64-nocm base box and the puppetlabs/cento-6.6-32-nocm base box for the student VM.
The Vagrant boxes will use the current local files for building rather than checking out the code from github. They have full write access, to be aware that new files in the repo be created and existing files may change.
There are three boxes specified.
To start a student vagrant box:
vagrant up
To start a training vagrant box for instructor use:
vagrant up training
To start a learning vagrant box:
vagrant up learning
To develop the VMs, you need to use modules and other code that haven't yet been merged to master or released to the forge. The non-vagrant VM build checks out code directly from github, so changes you make to the local filesystem won't be used, you need to push them to a branch and reference that branch in the build scripts:
- Fork this repo and create a branch for your changes.
- Update the build script to reference your namespace and branch
- You don't need to push this change, packer reads the local copy.
- You can also make temporary changes to the local packer json files without pushing.
- If you're changes are in a module, update the Puppetfile with the correct reference.
- Commit changes and push to your fork on github.
- Run the build.
- Iterate as needed.
- When module changes are merged to master and/or released on the forge, delete your education-build branch and build from master.
Note: Be careful that references to your namespace aren't included in PRs.
The version of PE used to build the VM is determined by the
pltraining-bootstrap module. To update the version, set the value of
$pe_version
in bootstrap::params
.
For pre-release builds:
- Make a branch of this repo and of pltraining-bootstrap.
- Edit the Puppetfile on this branch to point to your own fork and branch of pltraining-bootstrap.
- Edit the build script in
./scripts
to reference the correct branch of this repo at build time.
- Note this change does not need to be commited to the branch.
- Download the PE master and agent installers and place them in a
file_cache
directory in the root of this repository. - Update the
$pe_version
inbootstrap::params
in your branch of pltraining-bootstrap. - Make sure to add, commit, and push those changes.
- The packer build should run as usual.
If the initial setup script fails, delete the contents of output
and rerun.
VM builds will fail if the output artifacts already exist. You can avoid that
by using the --force
flag with packer. If a build does fail on the OVA export
you can run the ovftool directly. For example usage see scripts/export-ova.sh
.