Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Bootstrap script for 1.9.2

  • Loading branch information...
commit 1b1ae7b9ee0ed5b9c86903815d29fee8d7cac806 1 parent 4a6988c
@iafonov authored
Showing with 91 additions and 53 deletions.
  1. +91 −0 .chef/bootstrap/server_ubuntu_1_9_2.erb
  2. +0 −53 .chef/bootstrap/travis.erb
View
91 .chef/bootstrap/server_ubuntu_1_9_2.erb
@@ -0,0 +1,91 @@
+<% "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_2() {
+ if ruby -v | grep -q "1.9.2p320" >/dev/null ; then
+ printf "Ruby 1.9.3 is already installed skipping...\n"
+ return
+ fi
+
+ cd /tmp
+ wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p320.tar.gz
+ tar -xvzf ruby-1.9.2-p320.tar.gz
+ cd ruby-1.9.2-p320/
+ ./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}"
+
+ echo $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_2
+set_hostname_for_ubuntu
+add_opscode_apt_repo
+install_chef_server
+
+printf -- "-----> Bootstraping Chef Server on ${hostname} is complete.\n"
+
+'
View
53 .chef/bootstrap/travis.erb
@@ -1,53 +0,0 @@
-<% "based on https://github.com/fnichol/knife-server/blob/master/lib/chef/knife/bootstrap/chef-server-debian.erb" %>
-bash -c '
-
-set -x
-
-install_1_9_3() {
- apt-get -y install ruby1.9.1 ruby1.9.1-dev
-}
-
-setup() {
- platform="$(lsb_release -is | tr [[:upper:]] [[:lower:]])"
- platform_version="$(lsb_release -rs)"
-}
-
-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
-add_opscode_apt_repo
-install_chef_server
-
-printf -- "-----> Bootstraping Chef Server on ${hostname} is complete.\n"
-
-'
Please sign in to comment.
Something went wrong with that request. Please try again.