Permalink
Browse files

First import of a new implementation of stacker.

  • Loading branch information...
iafonov committed Jul 10, 2012
1 parent fe2a8e2 commit 4beeee4df8af9e01562e6e9b1f57ca1b7c8346cd
@@ -0,0 +1,88 @@
+# based on https://github.com/fnichol/knife-server/blob/master/lib/chef/knife/bootstrap/chef-server-debian.erb
+
+bash -c '
+export hostname="<%= @config[:chef_node_name] %>"
+export DEBIAN_FRONTEND=noninteractive
+
+set -x
+
+install_1_9_3() {
+ cd /tmp
+ wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
+ tar -xvzf ruby-1.9.3-p194.tar.gz
+ cd ruby-1.9.3-p194/
+ ./configure && make && make install
+ gem update --system
+ gem install bundler rake
+}
+
+setup() {
+ apt-get -y update
+ apt-get -y upgrade
+ apt-get -y install build-essential zlib1g-dev libssl-dev libreadline-dev libyaml-dev libcurl4-openssl-dev curl git-core python-software-properties
+
+ platform="$(lsb_release -is | tr [[:upper:]] [[:lower:]])"
+ platform_version="$(lsb_release -rs)"
+}
+
+set_hostname_for_ubuntu() {
+ if hostname | grep -q "$hostname" >/dev/null ; then
+ printf "Hostname is correct, so skipping...\n"
+ return
+ fi
+
+ local host_first="$(echo $hostname | cut -d . -f 1)"
+ local hostnames="${hostname} ${host_first}"
+
+ sed -i "s/^.*$/$hostname/" /etc/hostname
+ if egrep -q "^127.0.1.1[[:space:]]" /etc/hosts >/dev/null ; then
+ sed -i "s/^\(127[.]0[.]1[.]1[[:space:]]\+\)/\1${hostnames} /" \
+ /etc/hosts
+ else
+ sed -i "s/^\(127[.]0[.]0[.]1[[:space:]]\+.*\)$/\1\n127.0.1.1 ${hostnames} /" \
+ /etc/hosts
+ fi
+ service hostname start
+}
+
+add_opscode_apt_repo() {
+ echo "deb http://apt.opscode.com/ $(lsb_release -cs)-0.10 main" > \
+ /etc/apt/sources.list.d/opscode.list
+
+ # add the GPG Key and Update Index
+ mkdir -p /etc/apt/trusted.gpg.d
+ apt-get update
+ # permanent upgradeable keyring
+ apt-get install -y --force-yes opscode-keyring
+ apt-get upgrade -y
+}
+
+preseed_chef_pkg() {
+ local preseed=/var/cache/local/preseeding/chef-server.seed
+
+ mkdir -p $(dirname $preseed)
+ cat <<PRESEED > $preseed
+chef chef/chef_server_url string http://127.0.0.1:4000
+chef-server-webui chef-server-webui/admin_password password chefchef
+chef-solr chef-solr/amqp_password password chefchef
+PRESEED
+
+ debconf-set-selections $preseed
+}
+
+install_chef_server() {
+ preseed_chef_pkg
+
+ apt-get install -y --force-yes chef chef-server
+}
+
+setup
+install_1_9_3
+set_hostname_for_ubuntu
+add_opscode_apt_repo
+install_chef_server
+enable_ssl_proxy
+
+printf -- "-----> Bootstraping Chef Server on ${hostname} is complete.\n"
+
+'
View
@@ -0,0 +1,16 @@
+require 'librarian/chef/integration/knife'
+
+chef_server_url 'http://192.168.33.11:4000' # chef server url
+node_name 'ia' # your client name
+client_key 'client.pem' # your client key
+
+log_level :info
+log_location STDOUT
+
+cookbook_path "./vendor-cookbooks", Librarian::Chef.install_path
+
+validation_client_name 'chef-validator'
+validation_key './.chef/validation.pem'
+
+cache_type 'BasicFile'
+cache_options :path => '.chef/checksums'
View
@@ -0,0 +1,9 @@
+.rake_test_cache
+bin/
+vendor/
+.chef/client.pem
+.chef/checksums
+.bundle/
+.vagrant
+/cookbooks
+/tmp
View
45 .rvmrc
@@ -0,0 +1,45 @@
+#!/usr/bin/env bash
+
+environment_id="ruby-1.9.3-p194@chef-repo"
+if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
+ && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
+then
+ \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
+
+ if [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]]
+ then
+ . "${rvm_path:-$HOME/.rvm}/hooks/after_use"
+ fi
+else
+ # If the environment file has not yet been created, use the RVM CLI to select.
+ if ! rvm --create "$environment_id"
+ then
+ echo "Failed to create RVM environment '${environment_id}'."
+ return 1
+ fi
+fi
+
+#
+# If you use an RVM gemset file to install a list of gems (*.gems), you can have
+# it be automatically loaded. Uncomment the following and adjust the filename if
+# necessary.
+#
+# filename=".gems"
+# if [[ -s "$filename" ]]
+# then
+# rvm gemset import "$filename" | grep -v already | grep -v listed | grep -v complete | sed '/^$/d'
+# fi
+
+# If you use bundler, this might be useful to you:
+# if command -v bundle && [[ -s Gemfile ]]
+# then
+# bundle install
+# fi
+
+if [[ $- == *i* ]] # check for interactive shells
+then
+ echo "Using: $(tput setaf 2)$GEM_HOME$(tput sgr0)" # show the user the ruby and gemset they are using in green
+else
+ echo "Using: $GEM_HOME" # don't use colors in interactive shells
+fi
+
View
@@ -0,0 +1,14 @@
+site 'http://community.opscode.com/api/v1'
+
+# Git cookbook installs git-core, needed for deployment
+cookbook 'git'
+
+# ufw - it is always a good idea to enable and setup firewall for anything visible for the outside world
+cookbook 'firewall', :git => 'https://github.com/opscode-cookbooks/firewall.git'
+cookbook 'ufw'
+
+# MySQL - server + client
+# cookbook 'mysql', :git => 'https://github.com/cjoudrey/mysql'
+
+# Postfix
+cookbook 'postfix'
View
@@ -0,0 +1,27 @@
+SITE
+ remote: http://community.opscode.com/api/v1
+ specs:
+ dmg (1.0.0)
+ git (1.0.0)
+ dmg (>= 0.0.0)
+ runit (>= 0.0.0)
+ yum (>= 0.0.0)
+ postfix (1.2.0)
+ runit (0.15.0)
+ ufw (0.6.1)
+ firewall (>= 0.8)
+ yum (0.6.2)
+
+GIT
+ remote: https://github.com/opscode-cookbooks/firewall.git
+ ref: master
+ sha: 776b2e3011540ba1c852d27169070d80fc5c7caf
+ specs:
+ firewall (0.8.0)
+
+DEPENDENCIES
+ firewall (>= 0)
+ git (>= 0)
+ postfix (>= 0)
+ ufw (>= 0)
+
View
10 Gemfile
@@ -0,0 +1,10 @@
+source :rubygems
+
+gem 'chef'
+gem 'librarian'
+gem 'rake'
+gem 'knife-server'
+
+group :development do
+ gem 'vagrant'
+end
View
@@ -0,0 +1,114 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ archive-tar-minitar (0.5.2)
+ builder (3.0.0)
+ bunny (0.8.0)
+ chef (10.12.0)
+ bunny (>= 0.6.0)
+ erubis
+ highline (>= 1.6.9)
+ json (>= 1.4.4, <= 1.6.1)
+ mixlib-authentication (>= 1.1.0)
+ mixlib-cli (>= 1.1.0)
+ mixlib-config (>= 1.1.2)
+ mixlib-log (>= 1.3.0)
+ mixlib-shellout
+ moneta
+ net-ssh (~> 2.2.2)
+ net-ssh-multi (~> 1.1.0)
+ ohai (>= 0.6.0)
+ rest-client (>= 1.0.4, < 1.7.0)
+ treetop (~> 1.4.9)
+ uuidtools
+ yajl-ruby (~> 1.1)
+ childprocess (0.3.3)
+ ffi (~> 1.0.6)
+ erubis (2.7.0)
+ excon (0.14.3)
+ ffi (1.0.11)
+ fog (1.4.0)
+ builder
+ excon (~> 0.14.0)
+ formatador (~> 0.2.0)
+ mime-types
+ multi_json (~> 1.0)
+ net-scp (~> 1.0.4)
+ net-ssh (>= 2.1.3)
+ nokogiri (~> 1.5.0)
+ ruby-hmac
+ formatador (0.2.3)
+ highline (1.6.13)
+ i18n (0.6.0)
+ ipaddress (0.8.0)
+ json (1.5.4)
+ knife-ec2 (0.5.12)
+ chef (>= 0.10.10)
+ fog (~> 1.3)
+ knife-server (0.3.0)
+ chef (>= 0.10.10)
+ fog (~> 1.3)
+ knife-ec2 (~> 0.5.12)
+ net-ssh
+ librarian (0.0.24)
+ archive-tar-minitar (>= 0.5.2)
+ chef (>= 0.10)
+ highline
+ thor (~> 0.15)
+ log4r (1.1.10)
+ mime-types (1.19)
+ mixlib-authentication (1.1.4)
+ mixlib-log
+ mixlib-cli (1.2.2)
+ mixlib-config (1.1.2)
+ mixlib-log (1.4.1)
+ mixlib-shellout (1.0.0)
+ moneta (0.6.0)
+ multi_json (1.3.6)
+ net-scp (1.0.4)
+ net-ssh (>= 1.99.1)
+ net-ssh (2.2.2)
+ net-ssh-gateway (1.1.0)
+ net-ssh (>= 1.99.1)
+ net-ssh-multi (1.1)
+ net-ssh (>= 2.1.4)
+ net-ssh-gateway (>= 0.99.0)
+ nokogiri (1.5.5)
+ ohai (6.14.0)
+ ipaddress
+ mixlib-cli
+ mixlib-config
+ mixlib-log
+ systemu
+ yajl-ruby
+ polyglot (0.3.3)
+ rake (0.9.2.2)
+ rest-client (1.6.7)
+ mime-types (>= 1.16)
+ ruby-hmac (0.4.0)
+ systemu (2.5.1)
+ thor (0.15.4)
+ treetop (1.4.10)
+ polyglot
+ polyglot (>= 0.3.1)
+ uuidtools (2.1.2)
+ vagrant (1.0.3)
+ archive-tar-minitar (= 0.5.2)
+ childprocess (~> 0.3.1)
+ erubis (~> 2.7.0)
+ i18n (~> 0.6.0)
+ json (~> 1.5.1)
+ log4r (~> 1.1.9)
+ net-scp (~> 1.0.4)
+ net-ssh (~> 2.2.2)
+ yajl-ruby (1.1.0)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ chef
+ knife-server
+ librarian
+ rake
+ vagrant
Oops, something went wrong.

0 comments on commit 4beeee4

Please sign in to comment.