Create a gist now

Instantly share code, notes, and snippets.

# Compiling terraform-provisioner-ansible for Terraform 0.7.13 for Ubuntu Trusty
# $ mkdir terraform-trusty64
# $ cd terraform-trusty64/
# $ vagrant init ubuntu/trusty64
# $ vagrant up
# $ vagrant ssh
## Then run this script
sudo apt-get -y update
sudo apt-get install -y unzip git
mkdir $HOME/opt
cd $HOME/opt
wget -c
tar zxvf go1.7.3*gz
mkdir -p $HOME/work
echo 'export GOPATH=$HOME/work' >> $HOME/.bashrc
echo 'export GOROOT=$HOME/opt/go' >> $HOME/.bashrc
echo 'export PATH=$HOME/opt/go/bin:$PATH' >> $HOME/.bashrc
. $HOME/.bashrc
go env | grep GOPATH
go env | grep GOROOT
mkdir {src,pkg,bin}
cd src/
git clone
cd terraform-provisioner-ansible/
go get -v
### Use tag v0.7.13 for plugin to work.
cd ~/work/src/
git checkout v0.7.13
## Start rebuilding 0.7.13 version of terraform-provisioner. Goto hash w/o fixes yet.
cd $GOPATH/src/terraform-provisioner-ansible/
git checkout 5bfee6931ea36f53bb70fc5c013072be7f55c922
sed -i '/"apt-get update",/a "apt-get install -y libffi-dev libssl-dev",' provisioner.go
go build
mkdir $HOME/bin
cp terraform-provisioner-ansible $HOME/bin
## Configure terraform and provisioner
cd $HOME/bin
echo 'export PATH=$HOME/bin:$PATH' >> $HOME/.bashrc
export PATH=$HOME/bin:$PATH
cat <<EOF > $HOME/.terraformrc
provisioners {
ansible = "/home/vagrant/bin/terraform-provisioner-ansible"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment