forked from jeromegamez/ansible-macos-playbook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·52 lines (41 loc) · 1.16 KB
/
install.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
#!/usr/bin/env bash
set -o errexit
set -o errtrace
set -o nounset
REPO="https://github.com/jeromegamez/ansible-macos-playbook.git"
TARGET_DIR="$HOME/Development/ansible-macos-playbook"
if ! xcode-select --print-path &> /dev/null; then
echo "Installing Command Line Tools"
# Prompt user to install the Command Line Tools
xcode-select --install &> /dev/null
# Wait until the Command Line Tools are installed
until xcode-select --print-path &> /dev/null; do
sleep 5
done
echo "Done"
else
echo "Command Line Tools are already installed"
fi
if test ! $(which brew); then
echo "Installing Homebrew..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
echo "Done"
else
echo "Homebrew is already installed"
fi
if test ! $(which ansible); then
echo "Installing Ansible"
brew install ansible
echo "Done"
else
echo "Ansible is already installed"
fi
if [ ! -d "$TARGET_DIR" ]; then
echo "Cloning playbook repository"
mkdir -p "$TARGET_DIR" && git clone $REPO "$TARGET_DIR"
else
echo "The playbook repository is already in place"
fi
cd "$TARGET_DIR"
echo "Running the playbook"
ansible-playbook main.yml