kalharbi / packer-vagrant-template

Packer template for creating a Vagrant Box

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Packer template for Vagrant

A Packer Templates for creating a Vagrant CentOS box. This template uses a custom SSH key instead of the default random or insecure key.

Usage

  1. Generate your SSH key-pair using:

    ssh-keygen -t rsa -b 4096
  2. Export the required environment variables:

    $ export vagrant_private_key = /path/to/private/key
    $ export vagrant_public_key = /path/to/public/key
  3. Edit the template file to include the path to the ISO file and its checksum. Also, edit the installer script to provision the Vagrant box with the tools you need.

    $ vi centos-7-virtualbox.json
    $ vi installer.sh
  4. Build the image

    $ packer build -var "user=vagrant" -var "password=vagrant" -var "public_key=/path/to/public/key" -var "private_key=/path/to/private/key" ./centos-7-virtualbox.json 
  5. Create the Vagrant box from the image

    $ vagrant up
  6. Log in to the Vagrant box using ssh

    $ vagrant ssh

    License

    MIT

About

Packer template for creating a Vagrant Box


Languages

Language:Shell 100.0%