Created
August 1, 2012 21:14
-
-
Save btm/3230801 to your computer and use it in GitHub Desktop.
script for generating chef bootstrap-latest tarball
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'rubygems' | |
| require 'tempfile' | |
| require 'rake' | |
| opscode = "#{ENV['HOME']}/Development" | |
| bootstrap_cookbooks = %w[ | |
| apt | |
| apache2 | |
| runit | |
| couchdb | |
| chef | |
| chef-client | |
| chef-server | |
| openssl | |
| gecode | |
| java | |
| rabbitmq | |
| xml | |
| zlib | |
| erlang | |
| bluepill | |
| daemontools | |
| ucspi-tcp | |
| build-essential | |
| ] | |
| version = ENV["VERSION"] ? ENV["VERSION"] : "unreleased" | |
| tarball = "bootstrap-#{version}.tar.gz" | |
| bucket = "chef-solo" | |
| desc "Send chef bootstrap tarball to S3" | |
| task :s3 do | |
| require 'fog' | |
| connection = Fog::Storage.new( | |
| :provider => 'AWS', | |
| :aws_access_key_id => ENV["AWS_ACCESS_KEY_ID"], | |
| :aws_secret_access_key => ENV["AWS_SECRET_ACCESS_KEY"] | |
| ) | |
| connection.put_object(bucket, tarball, open(tarball), {'x-amz-acl' => 'public-read'}) | |
| puts "** Uploaded: #{tarball} to S3!" | |
| end | |
| desc "Create chef bootstrap tarball" | |
| task :tarball do | |
| Dir.chdir("#{opscode}") do | |
| sh "tar zcf #{tarball} cookbooks/{#{bootstrap_cookbooks.join(',')}}" | |
| end | |
| end | |
| desc "Create a new tarball and send it to S3" | |
| task :s3_tarball => [ :tarball, :s3 ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment