├── .gitignore ├── meta └── main.yml ├── roles ├── homebrew │ ├── meta │ │ └── main.yml │ ├── defaults │ │ └── main.yml │ ├── README.md │ └── tasks │ │ └── main.yml └── dotfiles │ ├── meta │ └── main.yml │ ├── defaults │ └── main.yml │ ├── tasks │ └── main.yml │ └── README.md ├── inventory ├── tasks ├── preferences.yml └── ansible-setup.yml ├── playbook.yml ├── files ├── sublime │ └── Library │ │ └── Packages │ │ └── User │ │ ├── Package Control.sublime-settings │ │ ├── Default (OSX).sublime-keymap │ │ ├── Preferences.sublime-settings │ │ └── DashDoc.sublime-settings └── etc │ └── sudoers ├── LICENSE ├── Vagrantfile ├── vars └── main.yml └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | *.vagrant 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: [] -------------------------------------------------------------------------------- /roles/homebrew/meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: [] -------------------------------------------------------------------------------- /roles/dotfiles/meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: [] 3 | -------------------------------------------------------------------------------- /inventory: -------------------------------------------------------------------------------- 1 | [localhost] 2 | 127.0.0.1 ansible_connection=local -------------------------------------------------------------------------------- /roles/dotfiles/defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dotfiles_repo: "https://github.com/ekryski/dotfiles.git" 3 | dotfiles_repo_local_destination: "~/Documents/dotfiles" 4 | dotfiles_home: "~" 5 | dotfiles_files: 6 | - .bash_profile 7 | - .gitignore 8 | - .inputrc 9 | - .vimrc 10 | -------------------------------------------------------------------------------- /roles/homebrew/defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | homebrew_install_path: /usr/local/homebrew 3 | homebrew_brew_bin_path: /usr/local/bin 4 | 5 | homebrew_installed_packages: 6 | - ssh-copy-id 7 | - pv 8 | 9 | homebrew_upgrade_all_packages: no 10 | 11 | homebrew_taps: 12 | - caskroom/cask 13 | 14 | homebrew_cask_apps: 15 | - firefox 16 | 17 | homebrew_cask_appdir: /Applications 18 | -------------------------------------------------------------------------------- /tasks/preferences.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # TODO: Custom iTerm theme/preferences. 3 | 4 | # Sudoers configuration (enables more convenient Vagrant usage). 5 | - name: Copy sudoers configuration into place. 6 | copy: 7 | src: files/etc/sudoers 8 | dest: /etc/sudoers 9 | mode: 0440 10 | validate: 'visudo -cf %s' 11 | sudo: yes 12 | when: configure_sudoers 13 | 14 | # TODO: Configure Sublime Text (see templates/sublime/*). 15 | -------------------------------------------------------------------------------- /tasks/ansible-setup.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Ensure Ansible downloads directory exists. 3 | file: 4 | path: "{{ downloads }}" 5 | state: directory 6 | 7 | - name: Ensure /etc/ansible directory exists. 8 | file: 9 | path: /etc/ansible 10 | state: directory 11 | sudo: yes 12 | 13 | - name: Symlink /usr/local/etc/ansible to /etc/ansible. 14 | file: 15 | src: /etc/ansible 16 | path: /usr/local/etc/ansible 17 | state: link 18 | -------------------------------------------------------------------------------- /playbook.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: localhost 3 | user: vagrant 4 | connection: local 5 | 6 | vars_files: 7 | - vars/main.yml 8 | 9 | roles: 10 | - homebrew 11 | - dotfiles 12 | 13 | tasks: 14 | - include: tasks/ansible-setup.yml 15 | # - include: tasks/preferences.yml 16 | 17 | # TODO: Use sudo once .osx can be run via root with no user interaction. 18 | # This doesn't seem to be working inside of Vagrant 19 | - name: Run .osx dotfiles. 20 | shell: ~/.osx --no-restart 21 | changed_when: false 22 | sudo: yes 23 | -------------------------------------------------------------------------------- /files/sublime/Library/Packages/User/Package Control.sublime-settings: -------------------------------------------------------------------------------- 1 | { 2 | "auto_upgrade_last_run": null, 3 | "installed_packages": 4 | [ 5 | "Babel", 6 | "DashDoc", 7 | "DocBlockr", 8 | "Dockerfile Syntax Highlighting", 9 | "Emmet", 10 | "FileDiffs", 11 | "GitGutter", 12 | "GitHub Flavored Markdown Preview", 13 | "Jinja2", 14 | "MarkAndMove", 15 | "Markdown Preview", 16 | "Package Control", 17 | "Pretty JSON", 18 | "RegReplace", 19 | "Sass", 20 | "LESS", 21 | "SublimeCodeIntel", 22 | "SublimeLinter", 23 | "TrailingSpaces", 24 | "WordCount", 25 | "Xdebug Client" 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /files/sublime/Library/Packages/User/Default (OSX).sublime-keymap: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "keys": ["super+alt+r"], 4 | "command": "reindent" 5 | }, 6 | { 7 | "keys": ["super+shift+w"], 8 | "command": "close_all" 9 | }, 10 | { 11 | "keys": ["tab"], 12 | "command": "expand_abbreviation_by_tab", 13 | "context": [ 14 | { 15 | "operand": "source.js", 16 | "operator": "equal", 17 | "match_all": true, 18 | "key": "selector" 19 | }, 20 | { 21 | "key": "selection_empty", 22 | "operator": "equal", 23 | "operand": true, 24 | "match_all": true 25 | } 26 | ] 27 | }, 28 | { "keys": ["tab"], "command": "next_field", "context": 29 | [ 30 | { "key": "has_next_field", "operator": "equal", "operand": true } 31 | ] 32 | } 33 | ] 34 | -------------------------------------------------------------------------------- /files/sublime/Library/Packages/User/Preferences.sublime-settings: -------------------------------------------------------------------------------- 1 | { 2 | "color_scheme": "Packages/Color Scheme - Default/Cobalt.tmTheme", 3 | "font_size": 12.0, 4 | "ignored_packages": 5 | [ 6 | "Vintage", 7 | "Markdown" 8 | ], 9 | "rulers": 10 | [ 11 | 80 12 | ], 13 | "line_numbers": true, 14 | "gutter": true, 15 | "margin": 4, 16 | "fold_buttons": true, 17 | "fade_fold_buttons": true, 18 | "spell_check": true, 19 | "tab_size": 2, 20 | "translate_tabs_to_spaces": true, 21 | "detect_indentation": true, 22 | "auto_indent": true, 23 | "smart_indent": true, 24 | "trim_automatic_white_space": false, 25 | "auto_match_enabled": true, 26 | "draw_minimap_border": false, 27 | "highlight_line": true, 28 | "match_brackets": true, 29 | "match_selection": true, 30 | "draw_white_space": "selection", 31 | "trim_trailing_white_space_on_save": false, 32 | "ensure_newline_at_eof_on_save": false 33 | } 34 | -------------------------------------------------------------------------------- /roles/dotfiles/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Ensure dotfiles repository is cloned locally. 3 | git: 4 | repo: "{{ dotfiles_repo }}" 5 | dest: "{{ dotfiles_repo_local_destination }}" 6 | sudo: no 7 | 8 | - name: Ensure all configured dotfiles are links. 9 | shell: "ls -F {{ dotfiles_home }}/{{ item }}" 10 | register: existing_dotfile_info 11 | failed_when: false 12 | always_run: yes 13 | changed_when: false 14 | with_items: dotfiles_files 15 | 16 | - name: Remove existing dotfiles file if a replacement is being linked. 17 | file: 18 | path: "{{ dotfiles_home }}/{{ dotfiles_files[item.0] }}" 19 | state: absent 20 | when: "'@' not in item.1.stdout" 21 | with_indexed_items: existing_dotfile_info.results 22 | 23 | - name: Link dotfiles into home folder. 24 | file: 25 | src: "{{ dotfiles_repo_local_destination }}/{{ item }}" 26 | dest: "{{ dotfiles_home }}/{{ item }}" 27 | state: link 28 | sudo: no 29 | with_items: dotfiles_files 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Eric Kryski http://erickryski.com 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | VAGRANTFILE_API_VERSION = 2 5 | 6 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 7 | config.vm.define "localhost" 8 | 9 | # Every Vagrant development environment requires a box. You can search for 10 | # boxes at https://atlas.hashicorp.com/search. 11 | # We're using a local box that we built. 12 | config.vm.box = "virtualbox-el-capitan" 13 | 14 | # Provider-specific configuration for VirtualBox 15 | config.vm.provider "virtualbox" do |vb| 16 | # Display the VirtualBox GUI when booting the machine 17 | # vb.gui = true 18 | 19 | # Customize the amount of memory on the VM: 20 | vb.memory = "2048" 21 | 22 | # Setup the synced directory. Needs to be RSync. Regular 23 | # synced_folder doesn't work. Maybe NFS would work 24 | config.vm.synced_folder ".", "/vagrant", type: "rsync" 25 | end 26 | 27 | # Install Ansible first because ansible_local isn't supported 28 | # in Vagrant on OS X (at least not El Capitan) 29 | config.vm.provision "shell", inline: <<-SHELL 30 | sudo easy_install pip 31 | sudo pip install ansible 32 | SHELL 33 | 34 | # 35 | # Run Ansible Playbook from your host machine on 36 | # the Vagrant Host 37 | # 38 | config.vm.provision "ansible_local" do |ansible| 39 | ansible.playbook = "playbook.yml" 40 | ansible.sudo = true 41 | ansible.inventory_path = "inventory" 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /roles/dotfiles/README.md: -------------------------------------------------------------------------------- 1 | # Ansible Role: Dotfiles 2 | 3 | Installs a set of dotfiles from a given Git repository. By default, it will install my (ekryski's) [dotfiles](https://github.com/ekryski/dotfiles), but you can use any set of dotfiles you'd like, as long as they follow a conventional format. 4 | 5 | ## Requirements 6 | 7 | None. 8 | 9 | ## Role Variables 10 | 11 | Available variables are listed below, along with default values (see `defaults/main.yml`): 12 | 13 | dotfiles_repo: "https://github.com/ekryski/dotfiles.git" 14 | 15 | The git repository to use for retrieving dotfiles. Dotfiles should generally be laid out within the root directory of the repository. 16 | 17 | dotfiles_repo_local_destination: "~/Documents/dotfiles" 18 | 19 | The local path where the `dotfiles_repo` will be cloned. 20 | 21 | dotfiles_home: "~" 22 | 23 | The home directory where dotfiles will be linked. Generally, the default should work, but in some circumstances, or when running the role as sudo on behalf of another user, you may want to specify the full path. 24 | 25 | dotfiles_files: 26 | - .bash_profile 27 | - .gitignore 28 | - .inputrc 29 | - .vimrc 30 | 31 | Which files from the dotfiles repository should be linked to the `dotfiles_home`. 32 | 33 | ## Dependencies 34 | 35 | None 36 | 37 | ## Example Playbook 38 | 39 | - hosts: localhost 40 | roles: 41 | - { role: ekryski.dotfiles } 42 | 43 | ## License 44 | 45 | MIT 46 | -------------------------------------------------------------------------------- /files/sublime/Library/Packages/User/DashDoc.sublime-settings: -------------------------------------------------------------------------------- 1 | { 2 | "syntax_sensitive_as_default": true, 3 | "syntax_docset_map": 4 | { 5 | "CSS" : ["css", "bootstrap", "foundation", "less", "cordova", "phonegap"], 6 | "Go" : ["go"], 7 | "GoSublime" : ["go"], 8 | "GoSublime-Go" : ["go"], 9 | "HTML" : ["php", "html"], 10 | "Java" : ["java", "javafx", "grails", "groovy", "playjava", "spring", "cvj", "processing"], 11 | "JavaScript" : ["javascript", "jquery", "jqueryui", "jquerym", "backbone", "marionette", "meteor", "sproutcore", "moo", "prototype", "bootstrap", "foundation", "lodash", "underscore", "ember", "sencha", "extjs", "knockout", "zepto", "yui", "d3", "svg", "dojo", "coffee", "nodejs", "express", "mongoose", "grunt", "chai", "html", "css", "cordova", "phonegap", "unity3d", "titanium"], 12 | "Markdown" : ["markdown"], 13 | "Objective-C" : ["iphoneos", "macosx", "appledoc", "cocos2d", "cocos3d", "kobold2d", "sparrow", "c", "manpages"], 14 | "PHP" : ["drupal", "php", "drupal", "symfony", "twig", "html", "mysql"], 15 | "Puppet" : ["puppet"], 16 | "Python" : ["python", "django", "twisted", "sphinx", "flask", "cvp"], 17 | "Ruby" : ["ruby", "rubygems", "rails"], 18 | "Ruby on Rails" : ["ruby", "rubygems", "rails"], 19 | "Sass" : ["sass", "compass", "bourbon", "neat", "css"], 20 | "Shell-Unix-Generic" : ["bash", "manpages"], 21 | "SQL" : ["mysql", "sqlite", "psql"], 22 | "TCL" : ["tcl"], 23 | "YAML" : ["ansible", "yaml", "drupal"], 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | downloads: ~/.ansible-downloads/ 3 | 4 | configure_sudoers: yes 5 | 6 | dotfiles_repo: https://github.com/ekryski/dotfiles.git 7 | dotfiles_repo_local_destination: ~/Dropbox/Development/dotfiles 8 | dotfiles_files: 9 | - .bash_profile 10 | - .gitconfig 11 | - .gitignore 12 | - .inputrc 13 | - .osx 14 | - .vimrc 15 | 16 | homebrew_upgrade_all_packages: yes 17 | homebrew_installed_packages: 18 | - ansible 19 | - autoconf 20 | - bash-completion 21 | - docker 22 | - docker-compose 23 | - docker-swarm 24 | # - gettext 25 | - git 26 | - go 27 | - tor 28 | - watchman 29 | - gpg 30 | - hub 31 | - iperf 32 | - libdvdcss 33 | - libevent 34 | - packer 35 | - terraform 36 | - otto 37 | - python 38 | - sqlite 39 | - certbot 40 | # - mysql 41 | # - npm 42 | - nvm 43 | # - php56 44 | # - php56-xdebug 45 | - ssh-copy-id 46 | # - cowsay 47 | - ios-sim 48 | # - readline 49 | - subversion 50 | # - kdiff3 51 | - openssl 52 | - pv 53 | # - drush 54 | - wget 55 | - wrk 56 | 57 | homebrew_taps: 58 | - caskroom/cask 59 | - homebrew/binary 60 | - homebrew/dupes 61 | # - homebrew/php 62 | - homebrew/versions 63 | 64 | homebrew_cask_appdir: /Applications 65 | homebrew_cask_apps: 66 | # - adium 67 | # - bettertouchtool 68 | - iterm2 69 | - slack 70 | - google-chrome 71 | - dropbox 72 | - fing 73 | - firefox 74 | - handbrake 75 | # - karabiner 76 | # - limechat 77 | # - licecap 78 | - macvim 79 | - menumeters 80 | # - nvalt 81 | # - sequel-pro 82 | # - skype 83 | # - skitch 84 | # - seil 85 | - sublime-text # Note - Sublime Text 2 only, at this time... 86 | # - textmate 87 | - timemachineeditor 88 | # - tower 89 | - sourcetree 90 | - transmit 91 | - vagrant 92 | - vagrant-manager 93 | - vlc 94 | - virtualbox 95 | - virtualbox-extension-pack 96 | -------------------------------------------------------------------------------- /roles/homebrew/README.md: -------------------------------------------------------------------------------- 1 | # Ansible Role: Homebrew 2 | 3 | Installs Homebrew on Mac OS X, and configures packages, taps, and cask apps according to supplied variables. 4 | 5 | ## Requirements 6 | 7 | None. 8 | 9 | ## Role Variables 10 | 11 | Available variables are listed below, along with default values (see `defaults/main.yml`): 12 | 13 | homebrew_install_path: /usr/local 14 | 15 | The path where Homebrew will be installed. It is recommended you stick to the default, otherwise Homebrew might have some weird issues. If you change this variable, you should also manually create a symlink back to /usr/local so things work as Homebrew expects. 16 | 17 | homebrew_brew_bin_path: /usr/local/bin 18 | 19 | The path where `brew` will be installed. 20 | 21 | homebrew_installed_packages: 22 | - ssh-copy-id 23 | - pv 24 | 25 | Packages you would like to make sure are installed via `brew install`. 26 | 27 | homebrew_upgrade_all_packages: no 28 | 29 | Whether to upgrade homebrew and all packages installed by homebrew. If you prefer to manually update packages via `brew` commands, leave this set to `no`. 30 | 31 | homebrew_taps: 32 | - caskroom/cask 33 | 34 | Taps you would like to make sure Homebrew has tapped. 35 | 36 | homebrew_cask_apps: 37 | - firefox 38 | 39 | Apps you would like to have installed via `cask`. Search for popular apps on http://caskroom.io/ to see if they're available for install via Cask. Cask will not be used if it is not included in the list of taps in the `homebrew_taps` variable. 40 | 41 | homebrew_cask_appdir: /Applications 42 | 43 | Directory where applications installed via `cask` should be installed. 44 | 45 | ## Dependencies 46 | 47 | None. 48 | 49 | ## Example Playbook 50 | 51 | - hosts: localhost 52 | vars: 53 | homebrew_installed_packages: 54 | - mysql 55 | roles: 56 | - { role: ekryski.homebrew } 57 | 58 | ## License 59 | 60 | MIT 61 | -------------------------------------------------------------------------------- /files/etc/sudoers: -------------------------------------------------------------------------------- 1 | # sudoers file. 2 | # 3 | # This file MUST be edited with the 'visudo' command as root. 4 | # Failure to use 'visudo' may result in syntax or file permission errors 5 | # that prevent sudo from running. 6 | # 7 | # See the sudoers man page for the details on how to write a sudoers file. 8 | # 9 | 10 | # Host alias specification 11 | 12 | # User alias specification 13 | 14 | # Cmnd alias specification 15 | 16 | # Defaults specification 17 | Defaults env_reset 18 | Defaults env_keep += "BLOCKSIZE" 19 | Defaults env_keep += "COLORFGBG COLORTERM" 20 | Defaults env_keep += "__CF_USER_TEXT_ENCODING" 21 | Defaults env_keep += "CHARSET LANG LANGUAGE LC_ALL LC_COLLATE LC_CTYPE" 22 | Defaults env_keep += "LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME" 23 | Defaults env_keep += "LINES COLUMNS" 24 | Defaults env_keep += "LSCOLORS" 25 | Defaults env_keep += "SSH_AUTH_SOCK" 26 | Defaults env_keep += "TZ" 27 | Defaults env_keep += "DISPLAY XAUTHORIZATION XAUTHORITY" 28 | Defaults env_keep += "EDITOR VISUAL" 29 | Defaults env_keep += "HOME MAIL" 30 | 31 | # Runas alias specification 32 | 33 | # User privilege specification 34 | root ALL=(ALL) ALL 35 | %admin ALL=(ALL) ALL 36 | 37 | # Uncomment to allow people in group wheel to run all commands 38 | # %wheel ALL=(ALL) ALL 39 | 40 | # Same thing without a password 41 | # %wheel ALL=(ALL) NOPASSWD: ALL 42 | 43 | # Samples 44 | # %users ALL=/sbin/mount /cdrom,/sbin/umount /cdrom 45 | # %users localhost=/sbin/shutdown -h now 46 | 47 | # Vagrant sudoers config 48 | Cmnd_Alias VAGRANT_EXPORTS_ADD = /usr/bin/tee -a /etc/exports 49 | Cmnd_Alias VAGRANT_NFSD = /sbin/nfsd restart 50 | Cmnd_Alias VAGRANT_EXPORTS_REMOVE = /usr/bin/sed -E -e /*/ d -ibak /etc/exports 51 | Cmnd_Alias VAGRANT_HOSTS_ADD = /bin/sh -c echo "*" >> /etc/hosts 52 | Cmnd_Alias VAGRANT_HOSTS_REMOVE = /bin/sed -i -e /*/ d /etc/hosts 53 | %admin ALL=(root) NOPASSWD: VAGRANT_EXPORTS_ADD, VAGRANT_NFSD, VAGRANT_EXPORTS_REMOVE, VAGRANT_HOSTS_ADD, VAGRANT_HOSTS_REMOVE 54 | -------------------------------------------------------------------------------- /roles/homebrew/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Setup homebrew install path. 3 | file: 4 | path: "{{ homebrew_install_path }}" 5 | group: admin 6 | mode: 0775 7 | state: directory 8 | sudo: yes 9 | 10 | - name: Ensure homebrew is installed. 11 | git: 12 | repo: git://github.com/Homebrew/homebrew.git 13 | version: master 14 | dest: "{{ homebrew_install_path }}" 15 | update: no 16 | accept_hostkey: yes 17 | 18 | - name: Ensure proper permissions on homebrew_brew_bin_path dirs. 19 | file: 20 | path: "{{ homebrew_brew_bin_path }}" 21 | group: admin 22 | mode: 0775 23 | state: directory 24 | recurse: true 25 | sudo: yes 26 | 27 | - name: Check if homebrew binary is already in place. 28 | stat: "path={{ homebrew_brew_bin_path }}/brew" 29 | register: homebrew_binary 30 | 31 | - name: Symlink brew to homebrew_brew_bin_path. 32 | file: 33 | src: "{{ homebrew_install_path }}/bin/brew" 34 | dest: "{{ homebrew_brew_bin_path }}/brew" 35 | state: link 36 | when: homebrew_binary.stat.exists == false 37 | sudo: yes 38 | 39 | # Tap. 40 | - name: Ensure configured taps are tapped. 41 | homebrew_tap: "tap={{ item }} state=present" 42 | with_items: homebrew_taps 43 | 44 | # Brew. 45 | - name: Ensure configured homebrew packages are installed. 46 | homebrew: "name={{ item }} state=present" 47 | with_items: homebrew_installed_packages 48 | 49 | - name: Upgrade all homebrew packages (if configured). 50 | homebrew: update_homebrew=yes upgrade_all=yes 51 | when: homebrew_upgrade_all_packages 52 | 53 | # Cask. 54 | - name: Get list of apps installed with cask. 55 | command: > 56 | bash -l -c '{{ homebrew_brew_bin_path }}/brew cask list' 57 | register: homebrew_cask_list 58 | always_run: yes 59 | changed_when: false 60 | 61 | # Use command module instead of homebrew_cask so appdir can be used. 62 | - name: Install configured cask applications. 63 | command: > 64 | bash -l -c '{{ homebrew_brew_bin_path }}/brew cask install {{ item }} --appdir={{ homebrew_cask_appdir }}' 65 | with_items: homebrew_cask_apps 66 | when: "'{{ item }}' not in homebrew_cask_list.stdout" 67 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Mac Development Ansible Playbook 2 | 3 | This playbook installs and configures most of the software I use on my Mac for web and software development. Some things in OS X are difficult to automate (notably, the Mac App Store and certain tools from Apple), so I still have some manual installation steps, but at least it's all documented here. 4 | 5 | This is a work in progress, and is mostly a means for me to document my current Mac's setup. I'll be adding settings and packages to this repository over time. It was originally forked from [geerlingguy/mac-dev-playbook](https://github.com/geerlingguy/mac-dev-playbook). 6 | 7 | ## Installation 8 | 9 | 1. [Install Ansible](http://docs.ansible.com/intro_installation.html). 10 | 2. Download and install Xcode. 11 | 3. Ensure Apple's command line tools are installed (`xcode-select --install` to launch the installer). 12 | 4. Clone this repository to your local drive. 13 | 5. Run `ansible-playbook main.yml -i inventory --ask-sudo-pass` from the same directory as this README file or run it in Vagrant using the instructions below. 14 | 15 | ## Included Applications / Configuration 16 | 17 | View this [main.yml](https://github.com/ekryski/mac-dev-playbook/blob/master/vars/main.yml) file to see what applications are installed. 18 | 19 | My [dotfiles](https://github.com/ekryski/dotfiles) are also installed into the current user's home directory, including the `.osx` dotfile for configuring many aspects of Mac OS X for better performance and ease of use. 20 | 21 | Finally, there are a few other preferences and settings added on for various apps and services. 22 | 23 | ## Future additions 24 | 25 | ### Things that still need to be done manually 26 | 27 | It's my hope that I can get the rest of these things wrapped up into Ansible playbooks soon, but for now, these steps need to be completed manually (assuming you already have Xcode and Ansible installed, and have run this playbook). 28 | 29 | 1. Generate SSH key and upload it to Github and Bitbucket 30 | 2. Set Homebrew Github access token: 31 | 32 | ``` 33 | Try again in 44 minutes 12 seconds, or create a personal access token: 34 | https://github.com/settings/tokens/new?scopes=&description=Homebrew and then set the token as: HOMEBREW_GITHUB_API_TOKEN 35 | ``` 36 | 37 | 3. Install [Sublime Package Manager](http://sublime.wbond.net/installation). 38 | 4. Install all the other apps (see below). 39 | 5. Configure extra Mail and/or Calendar accounts (e.g. Google, Exchange, etc.). 40 | 6. Install RVM for Ruby dev 41 | 7. Install virtual_env for python dev 42 | 8. Install latest stable ruby 43 | 9. Install latest stable nodejs 44 | 45 | ### Applications/packages to be added: 46 | I also use the following apps at least once or twice per week, but unfortunately, they are not able to be grabbed and installed via CLI, or any other way I can find (so far), I have to manually install all of these apps from within the App Store or from direct downloads. 47 | 48 | - Airmail 49 | - Amphetamine 50 | - Spotify 51 | - Speak 52 | - Screenhero 53 | - Sketch 54 | - Pixelmator 55 | - Principle for Mac 56 | - Paste 57 | - Omnigraffle 58 | - 1Password 59 | - Pages 60 | - Keynote 61 | - Numbers 62 | 63 | ### Configuration to be added: 64 | 65 | - I have Vim configuration in the repo, but I still need to add the actual installation: 66 | 67 | ``` 68 | mkdir -p ~/.vim/autoload 69 | mkdir -p ~/.vim/bundle 70 | cd ~/.vim/autoload 71 | curl https://raw.githubusercontent.com/tpope/vim-pathogen/master/autoload/pathogen.vim > pathogen.vim 72 | cd ~/.vim/bundle 73 | git clone git://github.com/scrooloose/nerdtree.git 74 | ``` 75 | 76 | ## Testing the Playbook 77 | 78 | I don't need to wipe my entire workstation and start from scratch just to test changes to the playbook. That would suck! Instead I use Vagrant to spin up an OSX virtual machine, on which I can continually run and re-run this playbook to test changes and make sure things work correctly. 79 | 80 | To do this simply run: 81 | 82 | 1. `vagrant init jhcook/osx-elcapitan-10.11;` 83 | 2. Add your provisioners: 84 | 85 | ```ruby 86 | Vagrant.configure(2) do |config| 87 | 88 | # Install Ansible first because ansible_local isn't supported 89 | # in Vagrant on OS X (at least not El Capitan) 90 | config.vm.provision "shell", inline: <<-SHELL 91 | sudo easy_install pip 92 | sudo pip install ansible 93 | SHELL 94 | 95 | # Run Ansible Playbook from your host machine on 96 | # the Vagrant Host 97 | config.vm.provision "ansible_local" do |ansible| 98 | ansible.playbook = "playbook.yml" 99 | ansible.sudo = true 100 | ansible.inventory_path = "inventory" 101 | end 102 | 103 | end 104 | ``` 105 | 106 | 3. `vagrant up` 107 | 108 | 109 | ### A bit more Neckbeardy 110 | 111 | If you want to build the VirtualBox Vagrant box manually and customize it, you can follow Tim Sutton's [amazing work](https://github.com/timsutton/osx-vm-templates) to build a Mac OS X VM image with [Packer](http://packer.io). 112 | 113 | #### TL; DR 114 | 115 | > **NOTE:** You need to have Vagrant installed 116 | 117 | 1. Download the El Capitan installer though the app store (or whatever OSX version you want). 118 | 2. `brew install virtualbox, virtualbox-extension-pack` 119 | 3. `git clone https://github.com/timsutton/osx-vm-templates` 120 | 4. `cd osx-vm-templates` 121 | 5. `sudo prepare_iso/prepare_iso.sh -D DISABLE_REMOTE_MANAGEMENT "/Applications/Install OS X El Capitan.app" out` 122 | 6. `packer build -var iso_checksum=dc34e0dcf6c34e626a85c40f19e9a85d -var iso_url=../out/OSX_InstallESD_10.11.2_15C50.dmg -only virtualbox-iso template.json` 123 | 7. `vagrant box add virtualbox-osx-el-capitan-10.1.1 ./packer_virtualbox-iso_virtualbox.box` 124 | 8. `vagrant init virtualbox-osx-el-capitan-10.1.1` 125 | 9. Add this to your Vagrantfile: 126 | 127 | ``` 128 | config.vm.provider "virtualbox" do |vb| 129 | # Display the VirtualBox GUI when booting the machine 130 | # vb.gui = true 131 | 132 | # Customize the amount of memory on the VM: 133 | vb.memory = "2048" 134 | 135 | # Setup the synced directory 136 | config.vm.synced_folder ".", "/vagrant", type: "rsync" 137 | end 138 | ``` 139 | 140 | 10. `vagrant up` 141 | 142 | #### Taking it a step further 143 | 144 | Once you have tested your Ansible playbook and are happy with it. You can solidify it a bit more by setting it up as a provisioner in Packer like so: 145 | 146 | ``` 147 | { 148 | "type": "ansible-local", 149 | "playbook_file": "main.yml" 150 | } 151 | ``` 152 | 153 | Then you can rebuild your Vagrant Box and the final image will have all your changes in Ansible applied as well! 154 | --------------------------------------------------------------------------------