-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.sh
executable file
·40 lines (33 loc) · 1.39 KB
/
bootstrap.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
#!/bin/bash
# Purpose:
# * bootstrap machine in order to prepare for ansible playbook run
set -e
# Download and install Command Line Tools if no developer tools exist
# * previous evaluation didn't work completely, due to gcc binary existing for vanilla os x install
# * gcc output on vanilla osx box:
# * 'xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install.
# * Choose an option in the dialog to download the command line developer tools'
#
# Evaluate 2 conditions
# * ensure dev tools are installed by checking the output of gcc
# * check to see if gcc binary even exists ( original logic )
# if either of the conditions are met, install dev tools
if [[ $(/usr/bin/gcc 2>&1) =~ "no developer tools were found" ]] || [[ ! -x /usr/bin/gcc ]]; then
echo "Info | Install | xcode"
xcode-select --install
fi
# Download and install Homebrew
if [[ ! -x /usr/local/bin/brew ]]; then
echo "Info | Install | homebrew"
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
# Download and install Ansible
if [[ ! -x /usr/local/bin/ansible ]]; then
echo "Info | Install | Ansible"
brew update
brew install ansible
fi
# Modify the PATH
# This should be subsequently updated in shell settings
export PATH=/usr/local/bin:$PATH
ansible-playbook local.yml -K