Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added support for installation via the Opscode Omnibus installer

  • Loading branch information...
commit 6f7861e20ecee809c7e35276f4aa35b8e75c1e6c 1 parent b8fa5f2
William McVey authored May 18, 2012
10  docs/index.rst
Source Rendered
@@ -85,4 +85,12 @@ Settings
85 85
 
86 86
     :default: ``{}``
87 87
 
88  
-    Additional JSON information you'd like to transfer to the server.
  88
+    Additional JSON information you'd like to transfer to the server.
  89
+
  90
+.. attribute:: use_omnibus_installer
  91
+
  92
+    :default: ``False``
  93
+
  94
+    Whether to use the
  95
+    `Opscode Omnibus Installer <http://www.opscode.com/chef/install/>`_
  96
+    to load Chef.
3  fabfile.py
@@ -3,5 +3,8 @@
3 3
 
4 4
 env.hosts = ['vagrant@localhost:2222']
5 5
 
  6
+# Uncomment to use the Opscode Omnibus installer
  7
+# chef.use_omnibus_installer = True
  8
+
6 9
 chef.add_recipe('python')
7 10
 chef.path = '/var/chef-solo'
23  provision/__init__.py
@@ -16,6 +16,7 @@
16 16
     gems='1.8.10',
17 17
     recipes=[],
18 18
     json={},
  19
+    use_omnibus_installer = False,
19 20
 )
20 21
 
21 22
 SOLO_RB = """
@@ -70,6 +71,18 @@ def gems():
70 71
     if not files.exists('/usr/local/bin/chef-solo'):
71 72
         sudo('gem install chef --no-rdoc --no-ri -n /usr/local/bin')
72 73
 
  74
+def omnibus_install():
  75
+    """Install Chef from Opscode's Omnibus installer
  76
+    """
  77
+    ctx = {
  78
+        'filename':'%(path)s/install.sh' % chef,
  79
+        'url':'http://opscode.com/chef/install.sh',
  80
+    }
  81
+    if not files.exists(ctx['filename']):
  82
+        sudo('wget -O %(filename)s %(url)s' % ctx)
  83
+    with cd(chef.path):
  84
+        sudo('bash install.sh')
  85
+
73 86
 def upload():
74 87
     ctx = {
75 88
         'cookbooks': '%(path)s/cookbooks' % chef,
@@ -107,13 +120,13 @@ def upload():
107 120
     files.append(ctx['solo.rb'], SOLO_RB % chef, use_sudo=True)
108 121
 
109 122
 @task(default=True)
110  
-def provision():
  123
+def provision(omnibus=False):
111 124
     sudo('mkdir -p %(path)s' % chef)
112 125
     apt()
113  
-    gems()
  126
+    if omnibus or chef.use_omnibus_installer:
  127
+        omnibus_install()
  128
+    else:
  129
+        gems()
114 130
     upload()
115 131
     with cd(chef.path):
116 132
         sudo('chef-solo -c solo.rb -j node.json')
117  
-    
118  
-    
119  
-    

0 notes on commit 6f7861e

Please sign in to comment.
Something went wrong with that request. Please try again.