소스 검색

cleaned up Vagrantfile

Alex Payne 11 년 전
부모
커밋
2b612336ae
1개의 변경된 파일31개의 추가작업 그리고 34개의 파일을 삭제
  1. 31
    34
      Vagrantfile

+ 31
- 34
Vagrantfile 파일 보기

@@ -1,48 +1,45 @@
1 1
 # The following patch needs to be applied for ansible to run cleanly on vagrant up:
2 2
 # https://github.com/mitchellh/vagrant/pull/1723.diff on /opt/vagrant/embedded/gems/gems/vagrant-1.2.x
3 3
 
4
-curdir=File.dirname(__FILE__)
5
-
6 4
 $boxes = [
7
-    {
8
-        :name => "ansible.local",
9
-        :forwards => { 22 => 22222, 80 => 80, 25 => 25, 143 => 143, 465 => 465, 993 => 993 }
5
+  {
6
+    :name => 'ansible.local',
7
+    :forwards => { 22  => 22222,
8
+                   80  => 80,
9
+                   25  => 25,
10
+                   143 => 143,
11
+                   465 => 465,
12
+                   993 => 993 
10 13
     }
14
+  }
11 15
 ]
12 16
 
13
-Vagrant.configure("2") do |config|
17
+Vagrant.configure('2') do |config|
18
+  config.vm.provider :lxc do |lxc, override|
19
+    override.vm.box     = 'precise64'
20
+    override.vm.box_url = 'http://bit.ly/vagrant-lxc-precise64-2013-05-08'
21
+  end
14 22
 
15
-    # only use if have downloaded https://github.com/fgrehm/vagrant-cachier
16
-    #config.cache.auto_detect = true
23
+  config.vm.provider :virtualbox do |vbox, override|
24
+    override.vm.box     = 'precise64'
25
+    override.vm.box_url = 'http://files.vagrantup.com/precise64.box'
26
+  end
17 27
 
18
-    # define some standard configuration for memory 
19
-    #config.vm.provider :lxc do |lxc|
20
-    #    lxc.customize 'cgroup.memory.limit_in_bytes', '400M'
21
-    #    lxc.customize 'cgroup.memory.memsw.limit_in_bytes', '500M'
22
-    #end
28
+  $boxes.each do |opts| 
29
+    config.vm.hostname = opts[:name]
23 30
 
24
-    config.vm.provider :lxc do |lxc, override|
25
-        override.vm.box = "precise64"
26
-        override.vm.box_url = "http://bit.ly/vagrant-lxc-precise64-2013-05-08"
27
-    end
28
-    config.vm.provider :virtualbox do |vbox, override|
29
-        override.vm.box = "precise64"
30
-        override.vm.box_url = "http://files.vagrantup.com/precise64.box"
31
+    opts[:forwards].each do |guest_port, host_port|
32
+      config.vm.network :forwarded_port, :guest => guest_port, :host => host_port
31 33
     end
32
-    $boxes.each do | opts | 
33
-        config.vm.define(opts[:name]) do |config|
34
-            config.vm.hostname =   "%s" % [ opts[:name].to_s ]
35
-            opts[:forwards].each do |guest_port,host_port|
36
-                config.vm.network :forwarded_port, guest: guest_port, host: host_port
37
-            end if opts[:forwards]
38 34
 
39
-            config.vm.provision :shell, :inline => 'if [ ! -e /root/apt.updated ]; then apt-get update && touch /root/apt.updated ; fi; apt-get install -y python-apt'
40
-            config.vm.provision :ansible do |ansible|
41
-                ansible.playbook = "site.yml"
42
-                #ansible.inventory_file = "hosts"
43
-            end
44
-            config.vm.provision :shell, :inline => "echo [test] > /vagrant/hosts.autogen && ifconfig eth0 | grep 'inet addr'|awk '{print $2}' |cut -d: -f2 >> /vagrant/hosts.autogen"
45
-            config.vm.provision :shell, :inline => "echo 'VM is setup'"
46
-        end if ! opts[:disabled]
35
+    config.vm.provision :shell,
36
+                        :inline => 'if [ ! -e /root/apt.updated ]; then apt-get update && touch /root/apt.updated ; fi; apt-get install -y python-apt'
37
+
38
+    config.vm.provision :ansible do |ansible|
39
+      ansible.playbook = 'site.yml'
47 40
     end
41
+    
42
+    config.vm.provision :shell,
43
+                        :inline => "echo [test] > /vagrant/hosts.autogen && ifconfig eth0 | grep 'inet addr' | awk '{print $2}' | cut -d: -f2 >> /vagrant/hosts.autogen"
44
+  end
48 45
 end

Loading…
취소
저장