-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathupdate-chef-server
More file actions
executable file
·41 lines (32 loc) · 1.07 KB
/
update-chef-server
File metadata and controls
executable file
·41 lines (32 loc) · 1.07 KB
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/sh
function echo_color {
echo "\033[1m$1\033[0m"
}
# change directory to the git repository root
cd $(git rev-parse --show-toplevel)/chef
echo_color "Updating cookbooks..."
knife cookbook upload -a
echo_color "Updating roles..."
for role in `ls roles/*.rb`; do
knife role from file $role
done
data_bags=$(knife data bag list)
if test "${data_bags#*deis-formations}" == "$data_bags"; then
echo_color "Creating deis-formations data bag..."
knife data bag create deis-formations
fi
if test "${data_bags#*deis-build}" == "$data_bags"; then
echo_color "Creating deis-build data bag..."
knife data bag create deis-build
echo "Uploading initial data bag items..."
knife data bag from file deis-build data_bags/deis-build/gitosis.json
fi
if test "${data_bags#*deis-ssh}" == "$data_bags"; then
echo_color "Creating deis-ssh data bag..."
knife data bag create deis-ssh
echo "Uploading initial data bag items..."
for item in `ls data_bags/deis-ssh`; do
knife data bag from file deis-ssh data_bags/deis-ssh/$item
done
fi
echo_color "Chef server up-to-date."