Skip to content

Instantly share code, notes, and snippets.

@avtar
Last active May 9, 2017 20:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avtar/2927b81f9de108a91818 to your computer and use it in GitHub Desktop.
Save avtar/2927b81f9de108a91818 to your computer and use it in GitHub Desktop.
Vagrant shell provisioner that runs ansible-playbook
#!/bin/sh
# Enable the EPEL repository
if [ ! -f /etc/yum.repos.d/epel.repo ]; then
sudo yum -y install epel-release
sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
fi
sudo yum -y install gcc python-devel python-pip
sudo pip install ansible
# Workaround for https://github.com/mitchellh/vagrant/issues/2103
sudo ansible-playbook /vagrant/site.yml -i /vagrant/hosts --connection=local
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "chef/centos-7.0"
config.vm.network "forwarded_port", guest: 8080, host: 8080
config.vm.provision :shell, :path => "bootstrap.sh"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment