forked from MariusCC/chef-bcpc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-chef.sh
executable file
·27 lines (23 loc) · 1.18 KB
/
install-chef.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
#!/bin/bash
set -e
# if you dont have internet access from your cluster nodes, you will
# not be able to "knife bootstrap" nodes to get them ready for
# chef. Instead you need to install chef separately. Assuming the
# necessary bits are hosted on your binary_server_url as setup by
# build_bins.sh this will allow you to proceed
BINARY_SERVER_HOST=${1:?"Need a Binary Server Host"}
BINARY_SERVER_URL=${2:?"Need a Binary Server URL"}
CHEF_SERVER_IP=${3:?"Need a Chef Server IP"}
CHEF_SERVER_HOSTNAME=${4:?"Need a Chef Server hostname"}
echo -e "${CHEF_SERVER_IP}\t$CHEF_SERVER_HOSTNAME" >> /etc/hosts
grep -q $BINARY_SERVER_HOST /etc/apt/apt.conf || echo "Acquire::http::Proxy::$BINARY_SERVER_HOST 'DIRECT';" >> /etc/apt/apt.conf
echo "deb [arch=amd64] $BINARY_SERVER_URL 0.5.0 main" > /etc/apt/sources.list.d/bcpc.list
wget --no-proxy -O - ${BINARY_SERVER_URL}/apt_key.pub | apt-key add -
apt-get update
apt-get install -y chef
# setup OpenStack hint
mkdir -p /etc/chef/ohai/hints/
touch /etc/chef/ohai/hints/openstack.json
# remove rubygems and install only our gemserver
/opt/chef/embedded/bin/gem sources --add ${BINARY_SERVER_URL}
/opt/chef/embedded/bin/gem sources --remove http://rubygems.org/