-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup
More file actions
executable file
Β·53 lines (42 loc) Β· 1.6 KB
/
setup
File metadata and controls
executable file
Β·53 lines (42 loc) Β· 1.6 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
#!/usr/bin/env bash
# Exit immediately if a command exits with a non-zero status
set -e
echo "π Bootstrapping workstation setup..."
# 1. Detect the Operating System
OS="$(uname -s)"
echo "π Detected OS: $OS"
# 2. Install Ansible based on the OS
if [ "$OS" = "Linux" ]; then
echo "π¦ Installing Ansible for Ubuntu/Debian..."
sudo apt update -y
sudo apt install -y software-properties-common
sudo apt install -y ansible
elif [ "$OS" = "Darwin" ]; then
echo "π Checking for Homebrew..."
if ! command -v brew &> /dev/null; then
echo "π¦ Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Make brew available in the current session for Apple Silicon/Intel
if [ -d "/opt/homebrew/bin" ]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
else
eval "$(/usr/local/bin/brew shellenv)"
fi
else
echo "β
Homebrew is already installed."
fi
echo "π¦ Installing Ansible for macOS..."
brew install ansible
else
echo "β Unsupported OS: $OS"
exit 1
fi
# 3. Install required Ansible collections
echo "π§© Installing required Ansible collections..."
ansible-galaxy collection install community.general
# 4. Run the Playbook
echo "βοΈ Running Ansible Playbook (setup.yml)..."
echo "Note: You may be prompted for your sudo password to install system packages."
# The -K flag tells Ansible to ask for your sudo (become) password
ansible-playbook -i localhost, setup.yml
echo "β
Setup complete! Please restart your terminal."