Ansible Roles
The mac-setup repo uses 9 Ansible roles, each responsible for a specific area of system configuration. This page documents what each role does, its tags, and the key files it manages.
Playbook Flow
The main playbook setup.yml runs in this order:
Pre-tasks
Before any role runs, the playbook:
- Checks Homebrew — verifies that
brewis installed and accessible - Gets Homebrew prefix — determines the Homebrew installation path (architecture-dependent)
- Validates env vars — confirms required environment variables are set in
~/.zshenv
Role Execution Order
Roles run sequentially in this order:
- homebrew
- mise
- shell
- git
- ssh
- apps
- aws
- dev-tools
- macos
Post-tasks
After all roles complete, a completion message is displayed confirming success.
1. homebrew
Tags: homebrew, packages
Updates Homebrew, then installs or removes formulae and casks based on the configured lists.
| Action | Details |
|---|---|
| Updates Homebrew | Runs brew update |
| Installs formulae | From homebrew_formulae list |
| Installs casks | From homebrew_casks list with accept_external_apps: true |
| Removes unlisted | Removes formulae/casks no longer in the lists |
Key files:
roles/homebrew/vars/main.yml— formulae and casks listsroles/homebrew/tasks/main.yml— installation tasks
2. mise
Tags: mise, runtimes
Manages runtime versions (Node.js, Python, Java, etc.) via mise.
| Action | Details |
|---|---|
| Symlinks config | Links mise configuration to ~/.config/mise/ |
| Trusts config | Runs mise trust on the config file |
| Installs runtimes | Installs all configured runtime versions |
| Reshims | Rebuilds shims after installation |
| Global npm packages | Installs npm packages that should be available globally |
Key files:
configs/mise/— mise configuration filesroles/mise/tasks/main.yml— installation and setup tasks
3. shell
Tags: shell, zsh
Sets up the complete shell environment.
| Action | Details |
|---|---|
Symlinks .zshrc |
Links from configs/shell/.zshrc |
Creates .zprofile |
Writes Homebrew initialization (eval "$(brew shellenv)") |
Symlinks starship.toml |
Links from configs/starship/starship.toml to ~/.config/ |
Copies .zshenv.example |
Creates ~/.zshenv from template if missing |
Key files:
configs/shell/.zshrc— main shell configurationconfigs/shell/.zshenv.example— template for environment variablesconfigs/starship/starship.toml— prompt configurationroles/shell/tasks/main.yml— symlink and setup tasks
4. git
Tags: git
Configures git with personal and work profiles using Jinja2 templates.
| Action | Details |
|---|---|
Renders .gitconfig |
Main git config from template (uses env vars) |
Renders .gitconfig-personal |
Personal profile (name, email, SSH key) |
Renders .gitconfig-work |
Work profile (name, email, SSH key) |
Symlinks .gitignore-work |
Work-specific gitignore rules |
Templates use environment variables (GIT_USER_NAME, GIT_PERSONAL_EMAIL, GIT_WORK_EMAIL, etc.) to populate personal data without committing secrets.
Key files:
roles/git/templates/— Jinja2 templates for git configsroles/git/tasks/main.yml— rendering and linking tasks
5. ssh
Tags: ssh
Sets up SSH configuration with support for multiple keys.
| Action | Details |
|---|---|
Creates .ssh directory |
Ensures ~/.ssh exists with correct permissions |
Renders ssh_config |
Main SSH config from template |
Creates config.local |
Creates a local override file if missing |
Key files:
roles/ssh/templates/— Jinja2 template for SSH configroles/ssh/tasks/main.yml— directory and config setup tasks
6. apps
Tags: apps
Configures application settings by symlinking config files and installing extensions.
| Action | Details |
|---|---|
| VS Code config | Symlinks settings and keybindings |
| Zed config | Symlinks settings and keymap |
| GH CLI config | Symlinks GitHub CLI configuration |
| Ghostty config | Symlinks terminal configuration |
| Claude config | Symlinks Claude Code configuration |
| Raycast config | Symlinks Raycast script commands and settings |
| btop config | Symlinks system monitor configuration |
| VS Code extensions | Installs extensions from configured list |
Key files:
configs/— all application config files, organized by approles/apps/vars/main.yml— VS Code extensions listroles/apps/tasks/main.yml— symlink and install tasks
7. aws
Tags: aws
Configures AWS CLI.
| Action | Details |
|---|---|
| Symlinks AWS config | Links from configs/aws/ to ~/.aws/ |
Key files:
configs/aws/— AWS configuration filesroles/aws/tasks/main.yml— symlink tasks
8. dev-tools
Tags: dev-tools
Sets up miscellaneous development tools and directories.
| Action | Details |
|---|---|
| fzf keybindings | Installs fzf shell keybindings |
| Project directories | Creates ~/personal and ~/work directories |
| Colima config | Symlinks Colima (Docker runtime) configuration |
Key files:
configs/colima/— Colima configurationroles/dev-tools/tasks/main.yml— setup tasks
9. macos
Tags: macos, defaults
Applies all macOS system defaults and restarts affected services.
| Action | Details |
|---|---|
| System defaults | Applies all configured defaults write commands |
| Restarts Dock | Applies Dock-related changes |
| Restarts Finder | Applies Finder-related changes |
| Restarts SystemUIServer | Applies UI-related changes |
See the macOS System Defaults page for the complete list of defaults.
Key files:
roles/macos/vars/main.yml— all defaults valuesroles/macos/tasks/main.yml— defaults and restart tasks