040f7a382f
- Created a new Ansible playbook for configuring macOS development stations. - Added role `macos_dev_station` with default variables, handlers, and tasks. - Implemented tasks for installing Homebrew packages, managing user configurations, and setting up launch agents for code-server and opencode. - Included templates for launchd plist files and startup scripts for code-server and opencode. - Added validation for required environment variables and configurations. - Updated inventory to include macOS hosts and added a setup script for initial prerequisites. - Modified Terraform configuration to include DNS records for new services.
56 lines
1.5 KiB
Bash
Executable File
56 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_NAME="$(basename "$0")"
|
|
LOG_FILE="${HOME}/.setup-dev-station.log"
|
|
|
|
log() {
|
|
printf '[%s] %s\n' "${SCRIPT_NAME}" "$*" | tee -a "${LOG_FILE}"
|
|
}
|
|
|
|
if [[ "$(uname -s)" != "Darwin" ]]; then
|
|
log "This script is for macOS only."
|
|
exit 1
|
|
fi
|
|
|
|
log "Starting macOS bootstrap for dev station prerequisites."
|
|
|
|
if ! xcode-select -p >/dev/null 2>&1; then
|
|
log "Installing Xcode Command Line Tools (follow GUI prompt once)."
|
|
xcode-select --install || true
|
|
else
|
|
log "Xcode Command Line Tools already installed."
|
|
fi
|
|
|
|
if ! command -v brew >/dev/null 2>&1; then
|
|
log "Installing Homebrew."
|
|
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
|
else
|
|
log "Homebrew already installed."
|
|
fi
|
|
|
|
if [[ -x /opt/homebrew/bin/brew ]]; then
|
|
eval "$(/opt/homebrew/bin/brew shellenv)"
|
|
fi
|
|
|
|
if ! grep -Fq '/opt/homebrew/bin/brew shellenv' "${HOME}/.zprofile" 2>/dev/null; then
|
|
log "Persisting Homebrew shellenv into ~/.zprofile."
|
|
printf '\n# Homebrew\neval "$(/opt/homebrew/bin/brew shellenv)"\n' >> "${HOME}/.zprofile"
|
|
else
|
|
log "Homebrew shellenv already present in ~/.zprofile."
|
|
fi
|
|
|
|
log "Updating Homebrew metadata."
|
|
brew update
|
|
|
|
log "Installing bootstrap packages."
|
|
brew install git curl jq python ansible
|
|
|
|
log "Preparing workspace directories."
|
|
mkdir -p "${HOME}/projects" "${HOME}/scripts"
|
|
|
|
log "Bootstrap complete."
|
|
log "Next step: run Ansible playbook for full dev-station configuration:"
|
|
log " cd ~/projects/a13labs.infra/ansible"
|
|
log " ansible-playbook playbook_macos_dev_station.yml --limit darwin_dev" |