Current CentOS Version Used: 7.5 (1804)
Pre-built Vagrant Box:
vagrant init geerlingguy/centos7
- See older versions: http://files.midwesternmac.com/
This example build configuration installs and configures CentOS 7 x86_64 minimal using Ansible, and then generates a Vagrant box file for VirtualBox.
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.
The following software must be installed/present on your local machine before you can use Packer to build the Vagrant box file:
- Packer
- Vagrant
- VirtualBox (if you want to build the VirtualBox box)
- Ansible
Make sure all the required software (listed above) is installed, then cd to the directory containing this README.md file, and run:
$ packer build -var 'version=1.2.0' centos7.json
After a few minutes, Packer should tell you the box was generated successfully, and the box was uploaded to Vagrant Cloud.
Note: This configuration includes a post-processor that pushes the built box to Vagrant Cloud (which requires a
VAGRANT_CLOUD_TOKEN
environment variable to be set); remove thevagrant-cloud
post-processor from the Packer template to build the box locally and not push it to Vagrant Cloud. You don't need to specify aversion
variable either, if not using thevagrant-cloud
post-processor.
There's an included Vagrantfile that allows quick testing of the built Vagrant boxes. From this same directory, run one the following command after building the box:
$ vagrant up
MIT license.
Created in 2014 by Jeff Geerling, author of Ansible for DevOps.