Skip to content
This repository has been archived by the owner on Nov 12, 2023. It is now read-only.

batteries included vagrant box to use terraform in conjuction with ansible

License

Notifications You must be signed in to change notification settings

danielr1996/vagrant-ansible-terraform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vagrant-ansible-terraform

ubuntu box to create your cloud resources with terraform and provision them with ansible.

Using

Create your Vagrantfile

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.box = "danielr1996/ansible-terraform"
  config.vm.synced_folder "./", "/home/vagrant/project", :mount_options => ["fmode=700"]
  config.ssh.extra_args = ["-t", "cd /home/vagrant/project; bash --login"]
  config.vm.provision "shell", run: "always", inline: <<SHELL
  # !IMPORTANT! specify the location to your terraform folder that includes terraform.tfstate
  echo "export ANSIBLE_TF_DIR=/home/vagrant/project/terraform" > /etc/profile.d/env.sh
SHELL
end

Start the box with vagrant up and login with vagrant ssh.

terraform and ansible are on the path, so you can use them right ahead.

This box comes with terraform-inventory preconfigured, to populate your terraform state refer to terraform-provider-ansible.

To quickly verify that all your hosts are reachable run ansible all -m ping

Building and customizing

Everything in this image was provisioned with the Vagrantfile, so if you build the image yourself you will get the same version as from Vagrant Cloud. To customize either add your desired customizations to the Vagrantfile or start the box and do your customization in the live machine.

vagrant up #start box
vagrant ssh #optional, login and customize live
vagrant package --output ansible-terraform.box

About

batteries included vagrant box to use terraform in conjuction with ansible

Resources

License

Stars

Watchers

Forks

Packages