Make everything actually work. Another monolithic commit.

This commit is contained in:
Jeff Geerling 2014-02-12 22:33:32 -06:00
parent c014d21aa4
commit 8e7f70ff00
19 changed files with 81 additions and 77 deletions

View file

@ -6,6 +6,12 @@ This is very much a work in progress, and is mostly a means for me to document m
**Caveat**: This set of playbooks is not meant to be a great example of Ansible best practices. I just want to wrap my Mac's configuration in Ansible so I can quickly bring up a new development Mac without having to restore from a Time Machine backup.
## Installation
1. Clone this repository somewhere.
2. Install Ansible.
3. Run `ansible-playbook main.yml --ask-sudo-pass`.
## Additions coming soon
### General changes:
@ -16,11 +22,15 @@ This is very much a work in progress, and is mostly a means for me to document m
- Cornerstone SVN
- Tower (Git)
- MenuMeters
- nvAlt
- PCKeyboardHack
- My dotfiles
- etc...
### Settings to be added:
- Terminal theme (Jeff's OSX)
- Sublime text settings/package manager
- Keyboard remappings (Caps Lock -> escape)
- Faster key repeat rates

View file

@ -1,6 +1,6 @@
---
- hosts: {{ hosts }}
user: {{ user }}
- hosts: all
connection: local
vars:
app_name: Google\ Chrome
app_name_pretty: Google Chrome
@ -8,8 +8,7 @@
installer_type: app
install_method: dmg
mount_path: /Volumes/Google\ Chrome/
vars_files:
- ../setup-vars.yml
downloads: ~/.ansible-downloads/
tasks:
- include: ../setup.yml
- include: ../install/{{ install_method }}.yml

View file

@ -1,6 +1,6 @@
---
- hosts: {{ hosts }}
user: {{ user }}
- hosts: all
connection: local
vars:
app_name: Firefox
app_name_pretty: Firefox
@ -8,8 +8,7 @@
installer_type: app
install_method: dmg
mount_path: /Volumes/Firefox/
vars_files:
- ../setup-vars.yml
downloads: ~/.ansible-downloads/
tasks:
- include: ../setup.yml
- include: ../install/{{ install_method }}.yml

View file

@ -1,6 +1,6 @@
---
- hosts: {{ hosts }}
user: {{ user }}
- hosts: all
connection: local
vars:
app_name: HandBrake
app_name_pretty: HandBrake
@ -8,8 +8,7 @@
installer_type: app
install_method: dmg
mount_path: /Volumes/HandBrake-0.9.9-MacOSX.6_GUI_x86_64/
vars_files:
- ../setup-vars.yml
downloads: ~/.ansible-downloads/
tasks:
- include: ../setup.yml
- include: ../install/{{ install_method }}.yml

View file

@ -1,10 +1,6 @@
---
- hosts: {{ hosts }}
user: {{ user }}
gather_facts: false
vars_files:
- ../setup-vars.yml
- hosts: all
connection: local
tasks:
- include: ../setup.yml
- name: Run Homebrew install script
shell: ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"

View file

@ -1,6 +1,6 @@
---
- hosts: {{ hosts }}
user: {{ user }}
- hosts: all
connection: local
vars:
app_name: Sequel\ Pro
app_name_pretty: Sequel Pro
@ -8,8 +8,7 @@
installer_type: app
install_method: dmg
mount_path: /Volumes/Sequel\ Pro\ 1.0.2/
vars_files:
- ../setup-vars.yml
downloads: ~/.ansible-downloads/
tasks:
- include: ../setup.yml
- include: ../install/{{ install_method }}.yml

View file

@ -1,6 +1,6 @@
---
- hosts: {{ hosts }}
user: {{ user }}
- hosts: all
connection: local
vars:
app_name: Sublime\ Text
app_name_pretty: Sublime\ Text
@ -8,12 +8,13 @@
installer_type: app
install_method: dmg
mount_path: /Volumes/Sublime\ Text/
vars_files:
- ../setup-vars.yml
downloads: ~/.ansible-downloads/
tasks:
- include: ../setup.yml
- include: ../install/{{ install_method }}.yml
- name: Create symlink subl for Sublime Text's subl command
file: src=/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl dest=/usr/bin/subl state=link
sudo: true
- name: Create symlink sublime for Sublime Text's subl command
file: src=/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl dest=/usr/bin/sublime state=link
file: src=/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl dest=/usr/bin/sublime state=link
sudo: true

View file

@ -1,14 +1,13 @@
---
- hosts: {{ hosts }}
user: {{ user }}
- hosts: all
connection: local
vars:
app_name: Transmit
app_name_pretty: Transmit
app_url: "http://download.panic.com/transmit/Transmit%204.4.6.zip"
installer_type: app
install_method: zip
vars_files:
- ../setup-vars.yml
downloads: ~/.ansible-downloads/
tasks:
- include: ../setup.yml
- include: ../install/{{ install_method }}.yml

View file

@ -1,16 +1,15 @@
---
- hosts: {{ hosts }}
user: {{ user }}
- hosts: all
connection: local
vars:
app_name: Vagrant
app_name_pretty: Vagrant
app_url: "https://dl.bintray.com/mitchellh/vagrant/Vagrant-1.4.3.dmg"
installer_type: pkg
install_method: dmg
install_target: /Volumes/OSX
install_target: /Volumes/Macintosh\ HD
mount_path: /Volumes/Vagrant/
vars_files:
- ../setup-vars.yml
downloads: ~/.ansible-downloads/
tasks:
- include: ../setup.yml
- include: ../install/{{ install_method }}.pkg
- include: ../install/{{ install_method }}.yml

View file

@ -1,8 +1,6 @@
---
- include: ../setup.yml
- hosts: {{ hosts }}
user: {{ user }}
- hosts: all
connection: local
vars:
app_name: VirtualBox
app_name_pretty: VirtualBox
@ -10,8 +8,8 @@
mount_path: /Volumes/VirtualBox/
installer_type: pkg
install_method: dmg
install_target: /Volumes/OSX
vars_files:
- ../setup-vars.yml
install_target: /Volumes/Macintosh\ HD
downloads: ~/.ansible-downloads/
tasks:
- include: ../install/{{ install_method }}.yml

View file

@ -1,6 +1,6 @@
---
- hosts: {{ hosts }}
user: {{ user }}
- hosts: all
connection: local
vars:
app_name: VLC
app_name_pretty: VLC
@ -8,8 +8,7 @@
installer_type: app
install_method: dmg
mount_path: /Volumes/vlc-2.1.3/
vars_files:
- ../setup-vars.yml
downloads: ~/.ansible-downloads/
tasks:
- include: ../setup.yml
- include: ../install/{{ install_method }}.yml

View file

@ -1,5 +1,3 @@
---
- name: Remove existing app if present
file: path=/Applications/{{ app_name }}.app state=absent
- name: Copy {{ app_name_pretty }} app to Applications directory
command: cp -R {{ app_name }}.app /Applications chdir={{ downloads }}
command: cp -R {{ app_name }}.app /Applications chdir={{ downloads }} creates=/Applications/{{ app_name }}.app

View file

@ -1,16 +1,16 @@
---
- name: Download {{ app_name_pretty }}
get_url: url={{ app_url }} dest={{ downloads }}/{{ app_name }}.dmg
# TODO: Idempotence.
- name: Mount {{ app_name_pretty }} image
command: hdiutil attach {{ app_name }}.dmg chdir={{ downloads }}
- name: Remove existing app if present
file: path=/Applications/{{ app_name }}.app state=absent
when_string: {{ installer_type }} == 'app'
- name: Copy {{ app_name_pretty }} app to Applications directory
command: cp -R {{ mount_path }}{{ app_name }}.app /Applications
when_string: {{ installer_type }} == 'app'
command: cp -R {{ mount_path }}{{ app_name }}.app /Applications creates=/Applications/{{ app_name }}.app
when: "installer_type == 'app'"
- name: Install {{ app_name_pretty }} pkg
command: sudo installer -package {{ mount_path }}{{ app_name }}.pkg -target {{ install_target }}
when_string: {{ installer_type }} == 'pkg'
command: installer -package {{ mount_path }}{{ app_name }}.pkg -target {{ install_target }}
sudo: yes
when: "installer_type == 'pkg'"
# TODO: Idempotence.
- name: Unmount {{ app_name_pretty }} image
command: hdiutil detach {{ mount_path }}

View file

@ -1,3 +1,4 @@
---
# TODO: Idempotence.
- name: Install {{ app_name }} pkg
command: sudo installer -package {{ app_name }}.pkg -target {{ install_target }}

View file

@ -9,12 +9,12 @@
command: tar xf {{ app_name }}.tar -C {{ app_name }}/ chdir={{ downloads }}
- name: Remove existing app if present
file: path=/Applications/{{ app_name }}.app state=absent
when_string: {{ installer_type }} == 'app'
when: "installer_type == 'app'"
- name: Copy {{ app_name_pretty }} app to Applications directory
command: cp -R {{ app_name }}/{{ app_name }}.app /Applications chdir={{ downloads }}
when_string: {{ installer_type }} == 'app'
when: "installer_type == 'app'"
- name: Install {{ app_name_pretty }} pkg
command: sudo installer -package {{ app_name }}/{{ app_name }}.pkg -target {{ install_target }} chdir={{ downloads }}
when_string: {{ installer_type }} == 'pkg'
when: "installer_type == 'pkg'"
- name: Remove extraction directory
file: path={{ downloads }}{{ app_name }}/ state=absent

View file

@ -9,12 +9,12 @@
command: unzip {{ app_name }}.zip -d {{ app_name }}/ chdir={{ downloads }}
- name: Remove existing app if present
file: path=/Applications/{{ app_name }}.app state=absent
when_string: {{ installer_type }} == 'app'
when: "installer_type == 'app'"
- name: Copy {{ app_name_pretty }} app to Applications directory
command: cp -R {{ app_name }}/{{ app_name }}.app /Applications chdir={{ downloads }}
when_string: {{ installer_type }} == 'app'
when: "installer_type == 'app'"
- name: Install {{ app_name_pretty }} pkg
command: sudo installer -package {{ app_name }}/{{ app_name }}.pkg -target {{ install_target }} chdir={{ downloads }}
when_string: {{ installer_type }} == 'pkg'
when: "installer_type == 'pkg'"
- name: Remove extraction directory
file: path={{ downloads }}{{ app_name }}/ state=absent

View file

@ -1,4 +1,16 @@
---
- name: Mac Development Playbook
hosts: self
user: jgeerling
connection: local
vars:
- downloads: ~/.ansible-downloads/
tasks:
- name: Create Ansible downloads directory
file: path={{ downloads }} state=directory
- include: apps/chrome.yml
- include: apps/firefox.yml
- include: apps/handbrake.yml

View file

@ -1,2 +0,0 @@
---
downloads: /.ansible-downloads/

View file

@ -1,3 +0,0 @@
---
- name: Create Ansible downloads directory
file: path={{ downloads }} state=directory