• Stars
    star
    133
  • Rank 272,600 (Top 6 %)
  • Language
    Shell
  • License
    MIT License
  • Created about 9 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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.

Buy Me A Coffee

More Repositories

1

Ansible

Python
167
star
2

ansible-rpi-k8s-cluster

Deploy Raspberry Pi Kubernetes cluster using Ansible
Jinja
144
star
3

vagrant-box-templates

Python
129
star
4

ansible-netplan

Ansible role to manage Netplan
Jinja
128
star
5

ansible-mariadb-galera-cluster

Jinja
126
star
6

graylog2

Shell
119
star
7

ansible-vsphere-management

Python
81
star
8

Packer-For-vSphere-and-More

Shell
77
star
9

ansible-netdata

An Ansible role to install/configure Netdata
Jinja
76
star
10

ansible-manage-lvm

Ansible role to manage LVM Groups/Logical Volumes
Python
76
star
11

Logstash_Kibana3

Shell
60
star
12

ansible-mdadm

Jinja
54
star
13

ansible-kvm

Jinja
51
star
14

ansible-rabbitmq

Ansible role to install/configure RabbitMQ
Erlang
46
star
15

ansible-zfs

Installs and configures ZFS On Linux
Shell
44
star
16

ansible-frr

Jinja
37
star
17

packer-templates-revisited

Shell
36
star
18

cacti

This repo will contain some of my templates and other goodies
36
star
19

ansible-config-interfaces

Jinja
33
star
20

ansible-samba

Jinja
32
star
21

ansible-nginx-load-balancer

Python
23
star
22

cookiecutter-ansible-role

A cookiecutter project template for Ansible roles
22
star
23

ansible-maas

An Ansible role to install/configure MAAS
22
star
24

ansible-openldap

Jinja
21
star
25

vagrant-ansible-routing-template

Python
21
star
26

dotfiles

Shell
21
star
27

vagrant-vault-consul-docker-monitoring

Shell
20
star
28

ansible-drbd

Jinja
20
star
29

ansible-opennms

Jinja
20
star
30

ansible-squid

Ansible role to install/configure Squid Proxy
Jinja
20
star
31

ansible-guacamole

Ansible role to install/configure Guacamole
Jinja
19
star
32

vagrant-ansible-docker-swarm

Python
19
star
33

ansible-dnsmasq

Enter description of Ansible role
Jinja
18
star
34

developers-workstation-setup

Shell
17
star
35

ansible-pacemaker

Jinja
16
star
36

terraform-to-ansible

Terraform to Ansible - Consume Terraform State as Ansible Inventory
Python
16
star
37

ansible-ipset

Jinja
16
star
38

ansible-k8s

HTML
15
star
39

ansible-docker

Enter description of Ansible role
Jinja
15
star
40

ansible-snort

Shell
14
star
41

ansible-kea-dhcp

14
star
42

ansible-motd

Shell
14
star
43

ansible-apt-sources

Enter description of Ansible role
Jinja
14
star
44

ansible-freenas

An Ansible role to manage FreeNAS
14
star
45

ansible-elkstack

Shell
14
star
46

ansible-cloud-init

Jinja
14
star
47

python-powerdns-management

Jinja
13
star
48

ansible-suricata

Shell
12
star
49

ansible-cmdb

PLpgSQL
12
star
50

ansible-control-machine

12
star
51

packer-builder

Packer Builder - Making Packer Building More Consumable
Python
11
star
52

ansible-logstash

11
star
53

ansible-manage-ssh-keys

11
star
54

ansible-chrony

Ansible role to install/configure Chrony
Jinja
11
star
55

ansible-glusterfs

Jinja
11
star
56

ansible-shorewall

10
star
57

hashi-learning

Shell
10
star
58

ansible-nfs-server

Jinja
10
star
59

ansible-prometheus

Ansible role to install/configure Prometheus
Jinja
10
star
60

ansible-stackstorm

Ruby
10
star
61

ansible-base

HTML
9
star
62

ansible-mongodb

8
star
63

ansible-apt-mirror

Jinja
8
star
64

ansible-windows-remote-desktop

8
star
65

terraform-builder

Terraform Builder - Build consistent Terraform configurations
Python
8
star
66

ansible-consul

Ansible role to install/configure Consul
Jinja
8
star
67

ansible-isc-dhcp

8
star
68

ansible-elasticsearch

An Ansible role to install/configure Elasticsearch
Jinja
8
star
69

ansible-kata-containers

Shell
8
star
70

ansible-openvswitch

8
star
71

vagrant-ansible-gerrit-lab

Shell
8
star
72

ansible-quagga

Shell
7
star
73

ansible-gerrit

7
star
74

ansible-windows-domain-controller

7
star
75

ansible-rundeck

Jinja
7
star
76

netbox

Ansible collection for installing/configuring/managing NetBox
Python
7
star
77

ansible-apache2

Jinja
7
star
78

docker-phpipam

PHP
7
star
79

vagrant-container-templates

Shell
7
star
80

sync-forked-repo

Python
7
star
81

ansible-windows-iis

7
star
82

ansible-collection-system

7
star
83

ansible-elk-processors

7
star
84

ansible-bootstrap-python

6
star
85

ansible-postfix

Jinja
6
star
86

ansible-mesosphere

Shell
6
star
87

ansible-influxdb

An Ansible role to install/configure InfluxDB
Jinja
6
star
88

ansible-es-filebeat

6
star
89

ansible-saltstack

An Ansible role to install/configure SaltStack
Jinja
6
star
90

ansible-awx

HTML
6
star
91

vmware-template-scripts

Shell
6
star
92

ansible-postgresql

Enter description of Ansible role
Jinja
6
star
93

ansible-clone-git-repos

Shell
6
star
94

ansible-jenkins

Ruby
6
star
95

ansible-docker-swarm

6
star
96

vagrant-ansible-k8s

Vagrant Ansible lab for Kubernetes
Ruby
6
star
97

ansible-change-hostname

6
star
98

docker-m1-development

Apple M1 development using Docker
Shell
5
star
99

ansible-mariadb-mysql

Shell
5
star
100

ansible-gitlab-runner

5
star