Skip to content

Commit 68625c0

Browse files
committed
Add Vagrantfile for testing provisions
Fixes #2
1 parent 8181095 commit 68625c0

File tree

3 files changed

+83
-0
lines changed

3 files changed

+83
-0
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ Thumbs.db
1919
*.kpf
2020
/.idea
2121

22+
# Vagrant files #
23+
.vagrant/
24+
vagrant_ansible_inventory_*
25+
ansible.cfg
26+
2227
# Other files #
2328
###############
2429
!empty

Vagrantfile

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby ts=2 sw=2 tw=0 et :
3+
4+
role = File.basename(File.expand_path(File.dirname(__FILE__)))
5+
6+
File.open(File.dirname(__FILE__) + '/ansible.cfg', 'w') { |f| f.write("[defaults]\nroles_path = ../") }
7+
8+
boxes = [
9+
{
10+
:name => "ubuntu-1004",
11+
:box => "opscode-ubuntu-10.04",
12+
:url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-10.04_chef-provisionerless.box",
13+
:ip => '10.0.0.10',
14+
:cpu => "50",
15+
:ram => "256"
16+
},
17+
{
18+
:name => "ubuntu-1204",
19+
:box => "opscode-ubuntu-12.04",
20+
:url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-12.04_chef-provisionerless.box",
21+
:ip => '10.0.0.11',
22+
:cpu => "50",
23+
:ram => "256"
24+
},
25+
{
26+
:name => "ubuntu-1404",
27+
:box => "opscode-ubuntu-14.04",
28+
:url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-14.04_chef-provisionerless.box",
29+
:ip => '10.0.0.12',
30+
:cpu => "50",
31+
:ram => "256"
32+
},
33+
{
34+
:name => "debian-6010",
35+
:box => "opscode-debian-6.0.10",
36+
:url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_debian-6.0.10_chef-provisionerless.box",
37+
:ip => '10.0.0.13',
38+
:cpu => "50",
39+
:ram => "256"
40+
},
41+
{
42+
:name => "debian-76",
43+
:box => "opscode-debian-7.6",
44+
:url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_debian-7.6_chef-provisionerless.box",
45+
:ip => '10.0.0.14',
46+
:cpu => "50",
47+
:ram => "256"
48+
},
49+
]
50+
51+
Vagrant.configure("2") do |config|
52+
boxes.each do |box|
53+
config.vm.define box[:name] do |vms|
54+
vms.vm.box = box[:box]
55+
vms.vm.box_url = box[:url]
56+
vms.vm.hostname = "ansible-#{role}-#{box[:name]}"
57+
58+
vms.vm.provider "virtualbox" do |v|
59+
v.customize ["modifyvm", :id, "--cpuexecutioncap", box[:cpu]]
60+
v.customize ["modifyvm", :id, "--memory", box[:ram]]
61+
end
62+
63+
vms.vm.network :private_network, ip: box[:ip]
64+
65+
vms.vm.provision :ansible do |ansible|
66+
ansible.playbook = "tests/vagrant.yml"
67+
ansible.verbose = "vv"
68+
end
69+
end
70+
end
71+
end

tests/vagrant.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
# test file for apt-file
3+
- hosts: all
4+
remote_user: vagrant
5+
sudo: true
6+
roles:
7+
- apt-file

0 commit comments

Comments
 (0)