Skip to content

Packer Example - CentOS 6 minimal Vagrant Box using Ansible provisioner

Notifications You must be signed in to change notification settings

queridiculo/packer-centos-6

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Packer Example - CentOS 6 minimal Vagrant Box using Ansible provisioner

Current CentOS Version Used: 6.7

This example build configuration installs and configures CentOS 6 x86_64 minimal using Ansible, and then generates two Vagrant box files, for:

  • VirtualBox
  • VMware

The example can be modified to use more Ansible roles, plays, and included playbooks to fully configure (or partially) configure a box file suitable for deployment for development environments.

Requirements

The following software must be installed/present on your local machine before you can use Packer to build the Vagrant box file:

You will also need some Ansible roles installed so they can be used in the building of the VM. To install the roles:

  1. Run $ ansible-galaxy install -r requirements.txt in this directory.
  2. If your local Ansible roles path is not the default (/etc/ansible/roles), update the role_paths inside centos6.json to match your custom location.

If you don't have Ansible installed (perhaps you're using a Windows PC?), you can simply clone the required Ansible roles from GitHub directly (use Ansible Galaxy to get the GitHub repository URLs for each role listed in requirements.txt), and update the role_paths variable to match the location of the cloned role.

Usage

Make sure all the required software (listed above) is installed, then cd to the directory containing this README.md file, and run:

$ packer build centos6.json

After a few minutes, Packer should tell you the box was generated successfully.

If you want to only build a box for one of the supported virtualization platforms (e.g. only build the VMware box), add --only=vmware-iso to the packer build command:

$ packer build --only=vmware-iso centos6.json

License

MIT license.

Author Information

Created in 2014 by Jeff Geerling, author of Ansible for DevOps.

About

Packer Example - CentOS 6 minimal Vagrant Box using Ansible provisioner

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 100.0%