Skip to content

Commit

Permalink
Merge pull request #2 from Oefenweb/vagrantfile-for-testing-provisions
Browse files Browse the repository at this point in the history
Added Vagrantfile for testing provisions
  • Loading branch information
tersmitten committed Sep 19, 2014
2 parents 70ca659 + 220857c commit 8685ce9
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ Thumbs.db
*.kpf
/.idea

# Vagrant files #
.vagrant/
vagrant_ansible_inventory_*
ansible.cfg

# Other files #
###############
!empty
71 changes: 71 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# -*- mode: ruby -*-
# vi: set ft=ruby ts=2 sw=2 tw=0 et :

role = File.basename(File.expand_path(File.dirname(__FILE__)))

File.open(File.dirname(__FILE__) + '/ansible.cfg', 'w') { |f| f.write("[defaults]\nroles_path = ../") }

boxes = [
{
:name => "ubuntu-1004",
:box => "opscode-ubuntu-10.04",
:url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-10.04_chef-provisionerless.box",
:ip => '10.0.0.10',
:cpu => "50",
:ram => "256"
},
{
:name => "ubuntu-1204",
:box => "opscode-ubuntu-12.04",
:url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-12.04_chef-provisionerless.box",
:ip => '10.0.0.11',
:cpu => "50",
:ram => "256"
},
{
:name => "ubuntu-1404",
:box => "opscode-ubuntu-14.04",
:url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-14.04_chef-provisionerless.box",
:ip => '10.0.0.12',
:cpu => "50",
:ram => "256"
},
{
:name => "debian-6.0.10",
:box => "opscode-debian-6.0.10",
:url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_debian-6.0.10_chef-provisionerless.box",
:ip => '10.0.0.13',
:cpu => "50",
:ram => "256"
},
{
:name => "debian-7.6",
:box => "opscode-debian-7.6",
:url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_debian-7.6_chef-provisionerless.box",
:ip => '10.0.0.14',
:cpu => "50",
:ram => "256"
},
]

Vagrant.configure("2") do |config|
boxes.each do |box|
config.vm.define box[:name] do |vms|
vms.vm.box = box[:box]
vms.vm.box_url = box[:url]
vms.vm.hostname = "ansible-#{role}-#{box[:name]}"

vms.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--cpuexecutioncap", box[:cpu]]
v.customize ["modifyvm", :id, "--memory", box[:ram]]
end

vms.vm.network :private_network, ip: box[:ip]

vms.vm.provision :ansible do |ansible|
ansible.playbook = "tests/vagrant.yml"
ansible.verbose = "vv"
end
end
end
end
7 changes: 7 additions & 0 deletions tests/vagrant.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
# test file for memcached
- hosts: all
remote_user: vagrant
sudo: true
roles:
- memcached

0 comments on commit 8685ce9

Please sign in to comment.