This repository was archived by the owner on Dec 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.sh
More file actions
executable file
·69 lines (57 loc) · 1.66 KB
/
bootstrap.sh
File metadata and controls
executable file
·69 lines (57 loc) · 1.66 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
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
#!/bin/bash
set -e
SOURCE_DIR=`dirname "${BASH_SOURCE[0]}"`
# Smoketest environment
if [[ `which python` ]]; then
echo "OK Found python!"
else
echo "Please install python first."
fi
if [[ `which pip` ]]; then
echo "OK Found python-pip!"
else
echo "INFO Installing python pip (https://en.wikipedia.org/wiki/Pip_(package_manager))"
sudo easy_install pip
fi
if [[ $OSTYPE == darwin* ]]; then
if [[ `which brew` ]]; then
echo "OK Found homebrew!"
else
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
if [[ $CI == true ]]; then
echo "INFO Running in CI mode. Not installing any packages"
else
brew tap Homebrew/bundle
echo "INFO Processing Brewfile..."
brew bundle
echo "Cleanup 'homebrew'"
brew cleanup && brew tap --repair
brew install dockutil
echo "Cleanup dock"
dockutil --remove all
fi
fi
# Installing most important package
if [[ `which ansible` ]]; then
echo "Ansible is already installed"
else
echo "INFO Installing ansible..."
if [[ $OSTYPE == darwin* ]]; then
brew install ansible
else
sudo apt-get install -y software-properties-common
sudo apt-add-repository -y ppa:ansible/ansible
sudo apt-get update
sudo apt-get install -y ansible
fi
fi
# Run ansible
echo "INFO Check ansible playbook"
ansible-playbook -i ${SOURCE_DIR}/hosts.ini -K ${SOURCE_DIR}/playbook.yml "$@" --syntax-check
if [[ $CI == true ]]; then
echo "INFO Not installing anything on CI environment for now. Exiting with last exit status..."
exit $?
fi
echo "INFO Execute ansible playbook"
ansible-playbook -i ${SOURCE_DIR}/hosts.ini -K ${SOURCE_DIR}/playbook.yml "$@"