The Problem:
You have a brand new fresh install of OSX on your MacBook and you need to get up and running. You want all your apps installed using Homebrew & Cask and OSX setup with goodies like zsh and .dotfiles.
The solution:
Use Ansible to deploy CLI apps via Homebrew and GUI Apps via Cask. Then have Ansible setup the shell with zsh and .dotfiles that are pulled from a GitHub repo.
GitHub - e30chris/Ansible-MacDeploy
Backstory:
Everything infrastructure is code according to proper DevOps and the MacBook that is the control center for that DevOps is certainly going to be setup using code as much as possible.
ToDo:
- Bring in OSX user settings like desktop backgrounds and other System Preferences.
Pre-Requisites:
- Fresh OSX install
- Homebrew installed
- Ansible installed via Homebrew
- GitHub Authenticated
- GitHub API token set
- .dotfiles forked and customized to your liking
Fresh OSX Install
Homebrew installed
Follow the SysAdmin Bible and read the script before you run it:
Github Raw of Homebrew install script
Run the script once verified that you know what it will be doing:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Verify Homebrew is correct:
sandor@theargo$ brew doctor
Install Ansible via Homebrew
Installing the latest from dev:
sandor@theargo$ brew install ansible --HEAD
GitHub Authenticated
sandor@theargo$ git config --global user.name "sandor"
sandor@theargo$ git config --global user.email "chris@e30chris.me"
sandor@theargo$ ssh-keygen -t rsa -b 4096 -C "sandor@macbook"
sandor@theargo$ ssh-add ~/.ssh/id_rsa
sandor@theargo$ pbcopy < ~/.ssh/id_rsa.pub
Add your SSH Public Key to GitHub -> Settings.
GitHub API Token Set
This avoids annoying brew errors on lookups.
.dotfile forked
Download and run the playbook
Download:
sandor@theargo$ git clone git@github.com:e30chris/Ansible-MacDeploy.git ~/Codestuff/Ansible/.
Edit:
- Set the OSX username that is running the playbook in vars/main.yml
Run:
sandor@theargo$ ansible-playbook -i hosts site.yml --ask-sudo-pass
Then run the .dotfiles bootstrap script
sandor@theargo$ ~/.dotfiles/script/bootstrap
Now go and setup all the OSX pieces that are not easily Ansibilized like the App Store.