-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.sh
More file actions
executable file
·54 lines (44 loc) · 1.3 KB
/
bootstrap.sh
File metadata and controls
executable file
·54 lines (44 loc) · 1.3 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
#!/usr/bin/env bash
# Ubuntu Server Bootstrap Script
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
echo "🚀 Ubuntu Server Configuration Bootstrap"
echo "=========================================="
echo
# Check if host.ini exists
if [ ! -f "$SCRIPT_DIR/host.ini" ]; then
echo "❌ Error: host.ini not found"
echo "📝 Please create host.ini from host.ini.example:"
echo " cp host.ini.example host.ini"
echo " # Then edit host.ini with your server details"
exit 1
fi
# Check if Ansible is installed
if ! command -v ansible-playbook >/dev/null 2>&1; then
echo "❌ Ansible not found"
echo "📦 Installing Ansible..."
sudo apt update
sudo apt install -y ansible
fi
echo "✅ Prerequisites checked"
echo
# Display configuration summary
echo "📋 Configuration Summary:"
echo " - Inventory: host.ini"
echo " - Playbook: ansible/playbook.yml"
echo " - Config: ansible/group_vars/all.yml"
echo
# Confirm before proceeding
read -p "Continue with server configuration? (yes/no): " -r
echo
if [[ ! $REPLY =~ ^[Yy][Ee][Ss]$ ]]; then
echo "❌ Configuration cancelled"
exit 0
fi
# Run Ansible playbook
echo "🔧 Running Ansible playbook..."
echo
ansible-playbook -i host.ini ansible/playbook.yml -vvv
echo
echo "✅ Bootstrap complete!"
echo "📖 See README.md for next steps"