Role Detail


Debian/Ubuntu configuration for Packer.
Type Ansible
Minimum Ansible Version 2.0
Installation $ ansible-galaxy install geerlingguy.packer-debian
Last Commit 2017-07-13 03:31:03 AM UTC
Last Imported 2017-08-10 18:03:06 PM UTC
Version History
Version Release Date
1.3.0 2017-07-13 03:31:03 AM
1.2.5 2017-01-22 02:01:02 AM
1.2.4 2016-06-21 03:39:03 AM
1.2.3 2016-03-25 19:32:07 PM
1.2.2 2016-03-04 05:11:05 AM
1.2.1 2016-01-19 15:52:03 PM
1.2.0 2016-01-18 19:36:07 PM
1.1.1 2015-08-03 02:29:02 AM
1.1.0 2015-06-24 17:45:05 PM
1.0.5 2015-04-28 18:59:06 PM
1.0.4 2015-03-22 19:48:07 PM
1.0.3 2015-03-22 16:43:04 PM
1.0.2 2014-07-15 17:25:05 PM
1.0.1 2014-05-30 04:30:04 AM
1.0.0 2014-05-29 20:17:08 PM
Supported Platforms
Platform Version
Debian etch
Debian jessie
Debian lenny
Debian sid
Debian squeeze
Debian stretch
Debian wheezy
Ubuntu artful
Ubuntu lucid
Ubuntu maverick
Ubuntu natty
Ubuntu oneiric
Ubuntu precise
Ubuntu quantal
Ubuntu raring
Ubuntu saucy
Ubuntu trusty
Ubuntu utopic
Ubuntu vivid
Ubuntu wily
Ubuntu xenial
Ubuntu yakkety
Ubuntu zesty
Last 10 Imports
Completed Status
2017-08-10 18:03:06 PM UTC SUCCESS
2017-08-09 23:16:11 PM UTC SUCCESS
2017-07-13 03:33:03 AM UTC SUCCESS
2017-07-13 03:33:03 AM UTC SUCCESS
2017-07-13 03:26:03 AM UTC SUCCESS
2017-07-06 05:19:05 AM UTC SUCCESS
2017-07-05 20:57:08 PM UTC SUCCESS
2017-06-25 05:18:05 AM UTC SUCCESS
2017-05-29 19:30:07 PM UTC SUCCESS
2017-05-24 19:11:07 PM UTC SUCCESS

Ansible Role: Packer Debian/Ubuntu Configuration for Vagrant VirtualBox

Build Status

This role configures Debian/Ubuntu (either minimal or full install) in preparation for it to be packaged as part of a .box file for Vagrant/VirtualBox or Vagrant/Vmware_desktop deployment using Packer.


Prior to running this role via Packer, you need to make sure Ansible is installed via a shell provisioner, and that preliminary VM configuration (like adding a vagrant user to the appropriate group and the sudoers file) is complete, generally by using a Kickstart installation file (e.g. ks.cfg) or preseeding with Packer. An example array of provisioners for your Packer .json template looks something like:

"provisioners": [
    "type": "shell",
    "execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E bash '{{.Path}}'",
    "script": "scripts/"
    "type": "ansible-local",
    "playbook_file": "ansible/main.yml",
    "role_paths": [

The files should contain, at a minimum:


An example for Ubuntu 16.04

#!/bin/bash -eux
# Install Ansible repository and Ansible.
apt -y install software-properties-common
apt-add-repository ppa:ansible/ansible
apt-get update
apt-get install ansible

An example for Debian 8.8

#!/bin/bash -eux
# Install Ansible repository and Ansible.
apt -y install software-properties-common
echo "deb trusty main" | tee -a /etc/apt/sources.list
apt-key adv --keyserver --recv-keys 93C4A3FD7BB9C367
apt -y update
apt -y install ansible


- hosts: all
  sudo: yes
  gather_facts: yes
    - geerlingguy.packer-debian

You might also want to add another shell provisioner to run cleanup, erasing free space using dd, but this is not required (it will just save a little disk space in the Packer-produced .box file).

If you'd like to add additional roles, make sure you add them to the role_paths array in the template .json file, and then you can include them in main.yml as you normally would. The Ansible configuration will be run over a local connection from within the Linux environment, so all relevant files need to be copied over to the VM; configuratin for this is in the template .json file. Read more: Ansible Local Provisioner.

Role Variables

Available variables are listed below, along with default values (see defaults/main.yml):

vmware_install_open_vm_tools: no

(VMware only) Using the vmware_install_open_vm_tools variable, you can select what kind of integration components will be installed into the VMware box. The default (no) installs VMware Tools, and not open-vm-tools.

Read more:



Example Playbook

- hosts: all
    - geerlingguy.packer-debian



Author Information

This role was created in 2014 by Jeff Geerling, author of Ansible for DevOps.