Skip to content
This repository has been archived by the owner on Sep 23, 2020. It is now read-only.

Commit

Permalink
What is old is now new
Browse files Browse the repository at this point in the history
  • Loading branch information
timf committed Oct 21, 2010
1 parent 3e6d783 commit ae9a2ee
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 15 deletions.
6 changes: 3 additions & 3 deletions libexec/epumgmt/fab-bootstrap/chefconf.rb
@@ -1,5 +1,5 @@
cookbook_path "/opt/dt-data/cookbooks"
cookbook_path "/opt/chef/cookbooks"
log_level :info
file_store_path "/opt/dt-data/tmp"
file_cache_path "/opt/dt-data/tmp"
file_store_path "/opt/chef/tmp"
file_cache_path "/opt/chef/tmp"
Chef::Log::Formatter.show_time = false
37 changes: 25 additions & 12 deletions libexec/epumgmt/fab-bootstrap/fabfile.py
Expand Up @@ -5,7 +5,7 @@
from fabric.decorators import runs_once

def bootstrap(rolesfile=None):
update_dt_data()
update()
put_chef_data(rolesfile=rolesfile)
run_chef_solo()

Expand All @@ -26,6 +26,7 @@ def put_provisioner_secrets():
print "ERROR. Please export AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY"
sys.exit(1)

ensure_opt()
run("sudo sh -c 'echo export NIMBUS_KEY=%s >> /opt/cei_environment'" % nimbus_key)
run("sudo sh -c 'echo export AWS_ACCESS_KEY_ID=%s >> /opt/cei_environment'" % ec2_key)

Expand All @@ -37,20 +38,32 @@ def update():
with hide('stdout'):
run("sudo apt-get -q update")

def update_dt_data():
# checkout the latest cookbooks:
with cd("/opt/dt-data"):
run("sudo git fetch")
run("sudo git reset --hard origin/HEAD")
def install_chef():
run("sudo apt-get install -y ruby-dev libopenssl-ruby rubygems")
run("sudo gem install chef ohai --no-ri --no-rdoc --source http://gems.opscode.com --source http://gems.rubyforge.org")
run("sudo ln -s /var/lib/gems/1.8/bin/chef-solo /usr/local/bin/")
run("sudo ln -s /var/lib/gems/1.8/bin/ohai /usr/local/bin/")

@runs_once
def ensure_opt():
run("if [ ! -d /opt ]; then sudo mkdir /opt; fi")

def put_chef_data(rolesfile=None):
ensure_opt()
run("if [ -d /opt/chef ]; then sudo rm -rf /opt/chef; fi")
run("sudo mkdir /opt/chef && sudo chown ubuntu:ubuntu /opt/chef")
# checkout the latest cookbooks:
run("sudo apt-get install -y git-core")
run("git clone http://github.com/clemesha-ooi/ooi-cookbooks.git /opt/chef/cookbooks")
# put the role and config files:
put("chefconf.rb", "/tmp/")
put(rolesfile or "chefroles.json", "/tmp/chefroles.json")
run("sudo mkdir -p /opt/dt-data/run")
run("sudo mv /tmp/chefconf.rb /tmp/chefroles.json /opt/dt-data/run/")
put("chefconf.rb", "/opt/chef/")
if rolesfile:
put(rolesfile, "/opt/chef/chefroles.json")
else:
put("chefroles.json", "/opt/chef/")


def run_chef_solo():
run("sudo chef-solo -l debug -c /opt/dt-data/run/chefconf.rb -j /opt/dt-data/run/chefroles.json")
run("sudo chef-solo -l debug -c /opt/chef/chefconf.rb -j /opt/chef/chefroles.json")



0 comments on commit ae9a2ee

Please sign in to comment.