View
@@ -0,0 +1,254 @@
---
#
# Setup/update homebrew junk
#
- hosts: localhost
vars:
- git_netrc_src: "/share/git-core/contrib/credential/netrc/git-credential-netrc"
- git_netrc_dst: "/libexec/git-core/git-credential-netrc"
# Make shit happen!
tasks:
- name: Check if running under vagrant
stat: path=/vagrant
register: vagrant
- name: Get brew install location
shell: >-
brew config |
grep HOMEBREW_PREFIX |
awk -F': ' '{print $2}'
register: brew_home
- name: Update Homebrew
homebrew: update_homebrew=yes
- name: List outdated homebrews
command: brew outdated
register: outdated
- debug: msg="{{outdated.stdout}}"
- name: Upgrade Homebrew installs
homebrew: upgrade_all=yes
- name: Setup Homebrew taps
homebrew_tap: name={{item}} state=present
with_items:
- homebrew/dupes
- homebrew/science
- homebrew/versions
- mitchty/yuck
- mitchty/clang_scan_view
- mitchty/clang_scan_build
- name: Install tmux
homebrew: state=present name=tmux install_options=wrap-pbcopy-and-pbpaste
- name: Make tmux copy/paste with osx possible
homebrew: state=present name=reattach-to-user-namespace
- name: Install mosh from HEAD
homebrew: state=head name=mobile-shell
- name: Install basic tools
homebrew: name={{item}} state=present
with_items:
- gpg
- git
- ansible
- htop
# Ok so we need to setup the gpg credential helper for netrc
- name: Get installed brew git version
shell: >-
brew info git 2>&1 |
head -n 1 |
awk '{print $3}' |
sed -e 's/,//g'
ignore_errors: true
register: brew_git_version
- name: Create link for git-credential-netrc to work
file: >-
src="{{brew_home.stdout}}/Cellar/git/{{brew_git_version.stdout}}{{git_netrc_src}}"
dest="{{brew_home.stdout}}/Cellar/git/{{brew_git_version.stdout}}{{git_netrc_dst}}"
state=link
- name: Install emacs with cocoa/srgb options
homebrew: state=present name=emacs install_options=cocoa,srgb
- name: Install curl with openssl/async dns options
homebrew: state=present name=curl install_options=with-openssl,with-ares
- name: Install stuff that I might want to use more quickly
homebrew: name={{item}} state=present
with_items:
- youtube-dl
- ag
- ispell
- docbook
- asciidoc
- libxml2
- libxslt
- readline
- sqlite
- gdbm
- wakeonlan
- name: Install python with universal/framework options
homebrew: state=present name=python install_options=universal,framework
# all this because 10.9 doesn't include libxml2 in the platform
# headers, LAME, also grr
- name: Get libxml2 pkg path
shell: >-
brew --env libxml2 |
grep PKG_CONFIG_PATH |
awk -F'=' '{print $2}' |
sed -e 's/\"//g'
register: libxml_pkg_config_path
- name: Get libxml2 pkg libdir
shell: >-
brew --env libxml2 |
grep PKG_CONFIG_LIBDIR |
awk -F'=' '{print $2}' |
sed -e 's/\"//g'
register: libxml_pkg_config_libdir
- name: Get libxml2 CFLAGS
environment:
PKG_CONFIG_PATH: "{{libxml_pkg_config_path.stdout}}"
PKG_CONFIG_LIBDIR: "{{libxml_pkg_config_libdir.stdout}}"
command: pkg-config --cflags libxml-2.0
register: libxml_cflags
- name: Get libxml2 LIBS
environment:
PKG_CONFIG_PATH: "{{libxml_pkg_config_path.stdout}}"
PKG_CONFIG_LIBDIR: "{{libxml_pkg_config_libdir.stdout}}"
command: pkg-config --libs libxml-2.0
register: libxml_libs
- name: Install Python pip modules
environment:
CFLAGS: "{{libxml_cflags.stdout}}"
LIBS: "{{libxml_libs}}.stdout"
PKG_CONFIG_PATH: "{{libxml_pkg_config_path.stdout}}"
PKG_CONFIG_LIBDIR: "{{libxml_pkg_config_libdir.stdout}}"
XML_CATALOG_FILES: "{{brew_home}}/etc/xml/catalog"
DYLD_LIBRARY_PATH: "{{brew_home}}/lib"
command: "{{brew_home.stdout}}/bin/pip install --upgrade {{item}}"
with_items:
- docutils
- howdoi
- pep8
- pyflakes
- flake8
- name: Link Python
homebrew: state=linked name=python
- name: Install ruby
homebrew: state=present name=ruby
- name: Install rubygems-update
command: "{{brew_home.stdout}}/bin/gem install --no-ri --no-rdoc rubygems-update"
- name: Install/Upgrade ruby gems
command: "{{brew_home.stdout}}/bin/gem install --no-ri --no-rdoc {{item}}"
with_items:
- pry
- maid
- gist
- name: Upgrade any old gems
command: "{{brew_home.stdout}}/bin/gem update -f"
- name: Upgrade any old gems --system
command: "{{brew_home.stdout}}/bin/gem update --system -f"
- name: gem clean
command: "{{brew_home.stdout}}/bin/gem clean"
- name: Link ruby
homebrew: state=linked name=ruby
- name: Install perl
homebrew: state=present name=perl
- name: Get hombrew perl /bin directory
command: brew --prefix perl
register: brew_perl_bin
# God, for annoying. So File::HomeDir sucks balls and its test suite
# fails on 10 tests when run under a user that isn't running a gui
# on osx. Yeah rare sure why not. But christ, why is the test suite
# dying and fix that. Time to file bugs I guess.
#
# So when under vagrant or rather /vagrant existing, don't install
# any stupid perl modules because they have ass tests that fail
# every damn time.
- name: Install cpanminus
# when: vagrant.stat.exists == false
shell: >-
curl -kL http://cpanmin.us |
"{{brew_perl_bin.stdout}}/bin/perl" - App::cpanminus --force --notest
- name: Install/Update cpan modules
command: "{{brew_perl_bin.stdout}}/bin/cpanm --notest --force {{item}}"
# when: vagrant.stat.exists == false
with_items:
- File::HomeDir
- App::cpanminus
- App::rainbarf
- Perl::Tidy
- Perl::Critic
- Encode
- Storable
- List::Util
- Hash::Util
- IO::Socket
- name: Link perl
homebrew: state=present name=perl
- name: Install postgres without perl/tcl/python options
homebrew: state=present name=postgres install_options=no-perl,no-tcl,without-python
- name: Install the rest of the lot
homebrew: name={{item}} state=present
with_items:
- lastpass-cli
- keychain
- yuck
- openssl
- pigz
- xz
- pixz
- pbzip2
- pv
- iperf
- nmap
- sntop
- rsync
- entr
- iftop
- tree
- pngcrush
- wget
- mercurial
- ack
- ncurses
- go
- python3
- clang-scan-view
- clang-scan-build
- gcc
- llvm
- neon
- mpv
- subversion16
- name: brew cleanup
command: brew cleanup
View
@@ -0,0 +1,12 @@
---
- hosts: localhost
vars:
- boot_volume: "SystemAudioVolume"
tasks:
- name: "Get boot volume setting"
shell: nvram "{{ boot_volume }}"
register: boot_volume_current
- name: "Set boot volume off"
shell: nvram "{{ boot_volume }}"=' '
when: boot_volume_current.stdout != "{{ boot_volume }}"
View
@@ -0,0 +1,214 @@
---
#
# Basically, all this is the crap I do to an osx system. Or the start
# of it at least.
#
# In a less civilized era, I used shell scripts for crap like this.
# or... nothing, the horror that ensued after a new install
# was legion.
#
- hosts: localhost
# All the stupid handlers to restart/kill crap as needed later
handlers:
- name: restart dock
command: killall Dock
ignore_errors: true
- name: kill finder with fire
command: killall Finder
ignore_errors: true
# mostly for 80 char lines tbh
vars:
- kb_key: "com.apple.keyboard.modifiermapping"
- kb_map_dest: "HIDKeyboardModifierMappingDst"
- kb_map_src: "HIDKeyboardModifierMappingSrc"
# Make shit happen!
tasks:
# GlobalDomain type defaults
# Caps lock sucks balls, make it control
- name: "Get internal usb keyboard vendor/product ids"
shell: >
ioreg -n IOHIDKeyboard -r |
grep -E 'VendorID"|ProductID' |
awk '{print $4}' |
paste -s -d'-\n' -
register: kb_id
# here be hacks matey, need to learn how to capture multiline
# output so that ansible doesn't complain
- name: "Read builtin keyboard map for caps lock setup"
shell: >
defaults -currentHost read -g
"{{ kb_key }}.{{ kb_id.stdout }}-0" |
perl -pe 's/(\n|\s+|{|}|\(|\)|\=|\;)//g' |
perl -pe 's/HIDKeyboardModifierMapping//g'
register: current_layout
# Note, this may not register until logging out/in.
# Killing cfprefsd (both root and user) doesn't force a reload
# of mavericks prefs cache (ungh why was that introduced)
# nor does stop/starting com.apple.syncdefaultsd either.
# nor does rereading the plist. I'm at a loss
# Maybe look into applescripting it I guess. But oh how I hate
# applescript.
- name: "Ensure builtin keyboard maps caps lock to control"
shell: >
defaults -currentHost write -g
"{{ kb_key }}.{{ kb_id.stdout }}-0"
-array "{HIDKeyboardModifierMappingDst=2;HIDKeyboardModifierMappingSrc=0;}"
when: current_layout.stdout != "Dst2Src0"
# Expand the save panel by default
- name: "Get expanded save mode"
command: "defaults read NSGlobalDomain NSNavPanelExpandedStateForSaveMode"
register: g_save_mode
ignore_errors: yes
- name: "Set expanded save panel mode"
command: "defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true"
when: g_save_mode.stdout != "1"
- name: "Get expanded save mode2"
command: "defaults read NSGlobalDomain NSNavPanelExpandedStateForSaveMode2"
register: g_save_mode2
ignore_errors: yes
- name: "Set expanded save panel mode2"
command: "defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true"
when: g_save_mode2.stdout != "1"
# So, the whole quarantine window is annoying, don't display it
- name: "Get launchservices quarantine setting"
command: "defaults read com.apple.LaunchServices LSQuarantine"
register: g_save_mode2
ignore_errors: yes
- name: "Set launchservices quarantine setting to off"
command: "defaults write com.apple.LaunchServices LSQuarantine -bool false"
when: g_save_mode2.stdout != "0"
# Double clicking title bars means minimize kthxbai
- name: "Get AppleMiniaturizeOnDoubleClick setting"
command: "defaults read NSGlobalDomain AppleMiniaturizeOnDoubleClick"
register: g_min_on_double_click
ignore_errors: yes
- name: "Set AppleMiniaturizeOnDoubleClick to true"
command: "defaults write NSGlobalDomain AppleMiniaturizeOnDoubleClick -bool false"
when: g_min_on_double_click.stdout != "0"
# Dock
# Dock goes on zie right, bottom is for heathens!
- name: "Get dock orientation value"
command: "defaults read com.apple.dock orientation"
register: dock_orientation
ignore_errors: yes
- name: "Set dock orientation to the left, where sane humans put it"
command: "defaults write com.apple.dock orientation -string left"
when: dock_orientation.stdout != "left"
notify:
- restart dock
# Dock should autohide because go away dammit
- name: "Get dock autohide value"
command: "defaults read com.apple.dock autohide"
register: dock_autohide
ignore_errors: yes
- name: "Set dock autohide to true"
command: "defaults write com.apple.dock autohide -bool true"
when: dock_autohide.stdout != "1"
notify:
- restart dock
# Dock should dim apps that have been hidden
- name: "Get dock showhidden value"
command: "defaults read com.apple.dock showhidden"
register: dock_showhidden
ignore_errors: yes
- name: "Set dock showhidden to true"
command: "defaults write com.apple.dock showhidden -bool true"
when: dock_showhidden.stdout != "1"
notify:
- restart dock
# Dock should use the hidden "Suck" animation, cause reasons.
- name: "Get dock mineffect value"
command: "defaults read com.apple.dock mineffect"
register: dock_mineffect
ignore_errors: yes
- name: "Set dock mineffect to Suck"
command: "defaults write com.apple.dock mineffect -string Suck"
when: dock_mineffect.stdout != "Suck"
notify:
- restart dock
# Dock should never use the dashboard, you were cool 10 years ago
# but sorry dashboard, I think we should see other people.
- name: "Get dock mcx-disabled value"
command: "defaults read com.apple.dock mcx-disabled"
register: dock_mcx_disabled
ignore_errors: yes
- name: "Set dock mcs-disabled to true"
command: "defaults write com.apple.dock mcx-disabled -bool true"
when: dock_mcx_disabled.stdout != "1"
notify:
- restart dock
# Finder
# I prefer to be able to have finder piss off until I need it
- name: "Get finder QuitMenuItem value"
command: "defaults read com.apple.finder QuitMenuItem"
register: finder_quitmenuitem
ignore_errors: yes
- name: "Set finder QuitMenuItem to true"
command: "defaults write com.apple.finder QuitMenuItem -bool true"
when: finder_quitmenuitem.stdout != "1"
notify:
- kill finder with fire
# STOP WRITING .DS_Store files on network volumes finder
- name: "Get finder DSDontWriteNetworkStores value"
command: "defaults read com.apple.finder DSDontWriteNetworkStores"
register: finder_dsdontwritenetworkstores
ignore_errors: yes
- name: "Set finder QuitMenuItem to true"
command: "defaults write com.apple.finder DSDontWriteNetworkStores -bool true"
when: finder_dsdontwritenetworkstores.stdout != "1"
notify:
- kill finder with fire
# show file extensions always, cause security/sanity
- name: "Get finder AppleShowAllExtensions value"
command: "defaults read com.apple.finder AppleShowAllExtensions"
register: finder_appleshowallextensions
ignore_errors: yes
- name: "Set finder AppleShowAllExtensions to true"
command: "defaults write com.apple.finder AppleShowAllExtensions -bool true"
when: finder_appleshowallextensions.stdout != "1"
notify:
- kill finder with fire
# Trackpad crap
- name: "Does the trackpad allow tap to click"
command: "defaults read com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking"
register: trackpad_click_tap
ignore_errors: yes
- name: "Set the trackpad to tap to click"
command: "defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true"
when: trackpad_click_tap.stdout != "1"
- name: "Does the trackpad allow double tap to right click"
command: "defaults read com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick"
register: trackpad_rightclick_tap
ignore_errors: yes
- name: "Set the trackpad to double tap to right click"
command: "defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true"
when: trackpad_rightclick_tap.stdout != "1"