-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathinstall.sh
executable file
·41 lines (28 loc) · 1004 Bytes
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
json="${1}"
logfile="/root/chef-solo.log"
# This runs as root on the server
chef_binary="/usr/local/bin/chef-solo"
# Are we on a vanilla system?
if ! test -f "$chef_binary"; then
export DEBIAN_FRONTEND=noninteractive
# Upgrade headlessly (this is only safe-ish on vanilla systems)
apt-get update -o Acquire::http::No-Cache=True
apt-get -o Dpkg::Options::="--force-confnew" --force-yes -fuy dist-upgrade
apt-get install -y curl build-essential zlib1g-dev libssl-dev libreadline-gplv2-dev libyaml-dev git-core bzip2
# Download ruby 1.9.3-p125
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz
tar -xvzf ruby-1.9.3-p125.tar.gz
# Install
cd ruby-1.9.3-p125/
./configure --prefix=/usr/local
make
make install
# Install chef
gem install chef ruby-shadow --no-rdoc --no-ri
# Return to the chef directory
cd ~/chef
fi
# Run chef-solo on server
"$chef_binary" --config solo.rb --json-attributes "$json"