-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbootstrap_macos.sh
executable file
·55 lines (45 loc) · 1.14 KB
/
bootstrap_macos.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
#!/usr/bin/env zsh
if ! xcode-select -p &> /dev/null; then
echo "Installing missing Xcode Command Line Tools..."
xcode-select --install
echo "Re-run script after installation has finished! Exiting..."
exit 1
fi
echo -n "Select which Ansible playbook to run...
h - setup_macos_home.yml
w - setup_macos_work.yml
[h]ome or [w]ork: "
read input
case $input in
h)
if [[ ! -f ~/.ssh/id_ed25519 ]]; then
echo "\nPrivate SSH key is missing! Exiting..."
exit 1
fi
git_url="git@github.com:ggustafsson/Ansiblebot.git"
playbook=setup_macos_home.yml
;;
w)
git_url="https://github.com/ggustafsson/Ansiblebot.git"
playbook=setup_macos_work.yml
;;
*)
echo "\nInput is not valid! Exiting..."
exit 1
;;
esac
echo
pip3 install --upgrade pip
pip3 install ansible
export PATH=/opt/homebrew/bin:$PATH
for dir in ~/Library/Python/*; do
export PATH=${dir}/bin:$PATH
done
echo
su admin -c "echo '$USER ALL = (ALL) ALL' | sudo tee /etc/sudoers.d/custom"
echo
mkdir ~/Projects
git clone $git_url ~/Projects/Ansiblebot
cd ~/Projects/Ansiblebot
ansible-playbook $playbook --ask-become -v
rm -rf ~/Library/Python