-
Notifications
You must be signed in to change notification settings - Fork 1
/
start.sh
executable file
·61 lines (51 loc) · 1.47 KB
/
start.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
#!/bin/bash
# Check if a package is installed
function is_installed {
local result_=1
type $1 >/dev/null 2>&1 || { local result_=0; }
echo "$result_"
}
echo "Configuring your dev environment..!"
echo "You'll be prompted for the sudo password now, please enter.."
# Install X-code, if not
xcode_dir=$(/usr/bin/xcode-select -print-path 2>/dev/null)
if ! [ -d "$xcode_dir" ]; then
echo "Command Line Tools is missing. Attempting to install.."
xcode-select --install > /dev/null 2>&1
# Wait for xcode to install
echo -n "Waiting for Commandline tools to install."
while true
do
if xcode-select --install 2>&1 | grep installed; then
echo "Command Line Tools is installed successfully"
break
fi
echo -n "."
sleep 1s
done
fi
# Install pip
if [[ $(is_installed pip) -eq 0 ]]; then
echo "Installing PIP"
sudo easy_install pip
fi
# Install ansible
if [[ $(is_installed ansible) -eq 0 ]]; then
echo "Installing Ansible"
sudo pip install ansible
fi
# check is cl-args exists.
ansible_add_tags=""
if [[ $# -ne 0 ]]
then
ansible_add_tags="--tags $1"
fi
# Run playbook
# ansible-playbook ./playbook.yml -i ./hosts $ansible_add_tags --ask-become-pass
if [ "$TRAVIS" = true ] ; then
ansible-playbook ./playbook.yml -i ./hosts $ansible_add_tags
else
ansible-playbook ./playbook.yml -i ./hosts $ansible_add_tags --ask-become-pass
fi
# Done
echo "All done.." | cowsay -f cheese | lolcat