-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinstallchef-server.sh
executable file
·100 lines (91 loc) · 2.5 KB
/
installchef-server.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/bash
################################
#
# Install Chef-server using Testkitchen
#
################################
# setup the default locations for the install
# and the default OS
#
COOKBOOKDIR=~/Source/Testkitchen/Chef-server
OS="centos-6.5"
OSnodots="centos-65"
COOKBOOK="Chef-server"
# destroy old instances that were lying around
#
cd $COOKBOOKDIR
kitchen destroy $COOKBOOK-$OSnodots
cd -
rm -Rf $COOKBOOKDIR
mkdir -p $COOKBOOKDIR/cookbooks
cd $COOKBOOKDIR/cookbooks
# download the Chef-server cookbook
#
git clone https://github.com/opscode-cookbooks/chef-server
cd ..
#
# check if running vmware_workstation or virtualbox,
# virtualbox is assumed the default
#
# Hint, set this variable on the command line before you
# run this script if you want vmware_workstation
#
case $VAGRANT_DEFAULT_PROVIDER in
vmware_workstation|vmware_fusion)
CPUVAR=numvcpus # name of cpu for vmware vagrant
;;
virtualbox)
CPUVAR=cpus # name of cpu for virtualbox vagrant
;;
*)
CPUVAR=cpus # name of cpu for virtualbox, default value
VAGRANT_DEFAULT_PROVIDER=virtualbox # default to virtualbox if environment variable not set.
echo "VAGRANT_DEFAULT_PROVIDER, not set, setting to virtualbox as default, for this script"
;;
esac
#
# create the config file for test kitchen
#
tee $COOKBOOKDIR/.kitchen.yml >/dev/null <<EOF
# setup of testkitchen to allow install of Chef-server via a chef script
# allow debug of kitchen scripts
# export KITCHEN_LOG='DEBUG'
driver:
name: vagrant
# replace "$USER" with your own username/id
driver_config:
customize:
memory: 4048
$CPUVAR: 2
provisioner:
name: chef_solo
platforms:
- name: $OS
suites:
- name: $COOKBOOK
run_list:
- recipe[chef-server::default]
attributes:
EOF
kitchen list
kitchen create $COOKBOOK-$OSnodots
kitchen converge $COOKBOOK-$OSnodots
#License and Authors
#===================
#
#Email:: <[email protected]>
#Author:: Scott Russell
#
#Copyright:: 2014, Scott Russell
#
#Licensed under the Apache License, Version 2.0 (the "License");
#you may not use this file except in compliance with the License.
#You may obtain a copy of the License at
#
#<http://www.apache.org/licenses/LICENSE-2.0>
#
#Unless required by applicable law or agreed to in writing, software
#distributed under the License is distributed on an "AS IS" BASIS,
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#See the License for the specific language governing permissions and
#limitations under the License.