Coder Social home page Coder Social logo

packer-templates's Introduction

Table of Contents generated with DocToc

packer-templates

Purpose

This repository is for maintaining my personal Vagrant Box Templates using Packer.

Information

All builds are based on the following providers:

NOTE: All builds are base builds and follow the Vagrant guidelines of how a Vagrant box should be built.

Requirements

All of my Packer templates are configured to upload to Vagrant Cloud after a successful build has been executed. In order to upload a box version to Vagrant Cloud, you will need to create a private_vars.json file in the root of this repo with the following info:

{
  "vagrant_cloud_token": "Your Vagrant Cloud private API token",
  "vagrant_cloud_username": "Your Vagrant Cloud username"
}

If you do not want this functionality, you will need to edit the respective template within the distro folder and remove the following:

{
  "type": "vagrant-cloud",
  "box_tag": "{{ user `box_tag` }}",
  "access_token": "{{ user `vagrant_cloud_token` }}",
  "version": "{{ timestamp }}"
}

Software

Usage

Building a box

To build a Vagrant box with Packer for Virtualbox:

Select distro

Choose which distro you are interested in building.

Build distro

NOTE: This example we will have chosen Ubuntu Xenial

cd Ubuntu/xenial64/server
packer build -var-file=../../../private_vars.json -var-file=ubuntu1604.json ../../ubuntu-server.json

Now watch your build kick off and run through the building process. Once it has completed you will be ready to test it out.

Testing a box

Once your build has completed you are ready to test it out.

Add box to Vagrant

Note: The number at the end is the epoch time of the build. Replace this accordingly.

cd Ubuntu/xenial64/server
vagrant box add xenial64-server-packer-template-virtualbox-1542509766 xenial64-server-packer-template-virtualbox-1542509766.box

Create Vagrantfile

cd ~
mkdir -p packer/vagrant/xenial64-server
cd packer/vagrant/xenial64-server
vagrant init xenial64-server-packer-template-virtualbox-1542509766

Spin it up

vagrant up

Test it out

vagrant ssh

Now do some basic tests to validate all is good.

Tear it down

vagrant destroy -f

Cleaning up

When you need to clean up any of the lingering files/folers generated during building, you can execute the cleanup_builds.sh script.

Using pre-built and ready for consumption Vagrant templates

The majority of these templates are used to populate my vagrant-box-templates repo. I would highly recommend leveraging this repo for testing and etc.

License

MIT

Author Information

Larry Smith Jr.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.