Skip to content

scorputty/packer-centos

Repository files navigation

Vagrant Ansible Packer CentOS-7

A set of (Ansible) scripts around Packer by HashiCorp to build a CentOS 7 box for Oracle VM VirtualBox.

  • The idea is that the Kickstart file 'ks.cfg' is as simple as possible and all the configuration is done by Ansible.

Note

Change the variables to your location in 'defaults/main.yml'

Changes

Mayor overhaul! Switched to chronyd instead of ntpd, also merged the VirtualBox GuestAdditions in to the one main task since I'm only building CentOS for VirtualBox at the moment.

Other notables:

HowTo

These steps explain how this Packer Ansible build is setup.

Prerequisites (on a mac)

    brew cask install virtualbox
    brew cask install vagrant
    brew cask install virtualbox-extension-pack
    brew install ansible
    brew install packer

Clone this repo

    git clone https://github.com/scorputty/packer-centos.git
    cd packer-centos
    time packer build centos7-virtualbox.json (or centos7-virtualbox-local.json)

Info

There are two build files, one local and one that does a upload of the image to Vagrant Cloud. If you want the box to upload to Vagrant Cloud you need to add your ATLAS_TOKEN to your shell ENV (.bash_profile. More info here.

Test / develop / troubleshoot Ansible from within the Vagrant box like so:

    vagrant up
    ansible-playbook --user=vagrant --ask-pass -i inventory.yml ansible/site.yml
    vagrant init virtualbox-centos-7 builds/virtualbox-centos-7.box
    vagrant up
    vagrant ssh
    sudo -s
    yum install -y epel-release
    yum install -y ansible
    ansible-playbook -i "localhost," -c local /vagrant/ansible/site.yml

Note

More info on the Ansible part is in the README.md in ansible/roles/packer-rhel

Releases

No releases published

Packages

No packages published

Languages