Change yaml to yml, clean up, update variables.

This commit is contained in:
Jeff Geerling 2014-02-12 21:47:18 -06:00
parent a8d7f2d0ed
commit c014d21aa4
46 changed files with 238 additions and 270 deletions

View file

@ -6,12 +6,31 @@ 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.
## TODO
## Additions coming soon
I'm going to add the following once I get some time:
### General changes:
- Don't uninstall/replace already-installed applications.
### Applications/packages to be added:
- Cornerstone SVN
- Tower (Git)
- PCKeyboardHack
- etc...
### Settings to be added:
- Sublime text settings/package manager
- Keyboard remappings (Caps Lock -> escape)
- Faster key repeat rates
- Desktop background
- Trackpad tracking rate
- Mouse tracking rate
- Finder settings:
- Disable "show warning before changing extension"
- Set default view to column mode
- Show hard disks, connected servers on desktop
- etc...
## Ansible for DevOps

15
apps/chrome.yml Normal file
View file

@ -0,0 +1,15 @@
---
- hosts: {{ hosts }}
user: {{ user }}
vars:
app_name: Google\ Chrome
app_name_pretty: Google Chrome
app_url: "https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg"
installer_type: app
install_method: dmg
mount_path: /Volumes/Google\ Chrome/
vars_files:
- ../setup-vars.yml
tasks:
- include: ../setup.yml
- include: ../install/{{ install_method }}.yml

15
apps/firefox.yml Normal file
View file

@ -0,0 +1,15 @@
---
- hosts: {{ hosts }}
user: {{ user }}
vars:
app_name: Firefox
app_name_pretty: Firefox
app_url: "https://download.mozilla.org/?product=firefox-27.0&os=osx&lang=en-US"
installer_type: app
install_method: dmg
mount_path: /Volumes/Firefox/
vars_files:
- ../setup-vars.yml
tasks:
- include: ../setup.yml
- include: ../install/{{ install_method }}.yml

15
apps/handbrake.yml Normal file
View file

@ -0,0 +1,15 @@
---
- hosts: {{ hosts }}
user: {{ user }}
vars:
app_name: HandBrake
app_name_pretty: HandBrake
app_url: "http://handbrake.fr/rotation.php?file=HandBrake-0.9.9-MacOSX.6_GUI_x86_64.dmg"
installer_type: app
install_method: dmg
mount_path: /Volumes/HandBrake-0.9.9-MacOSX.6_GUI_x86_64/
vars_files:
- ../setup-vars.yml
tasks:
- include: ../setup.yml
- include: ../install/{{ install_method }}.yml

10
apps/homebrew.yml Normal file
View file

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

15
apps/sequel-pro.yaml Normal file
View file

@ -0,0 +1,15 @@
---
- hosts: {{ hosts }}
user: {{ user }}
vars:
app_name: Sequel\ Pro
app_name_pretty: Sequel Pro
app_url: "https://sequel-pro.googlecode.com/files/sequel-pro-1.0.2.dmg"
installer_type: app
install_method: dmg
mount_path: /Volumes/Sequel\ Pro\ 1.0.2/
vars_files:
- ../setup-vars.yml
tasks:
- include: ../setup.yml
- include: ../install/{{ install_method }}.yml

View file

@ -1,18 +1,18 @@
---
- hosts: $hosts
user: $user
- hosts: {{ hosts }}
user: {{ user }}
vars:
app_name: Sublime\ Text
app_name_pretty: Sublime\ Text
app_url: http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%20Build%203021.dmg
app_url: "http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%20Build%203059.dmg"
installer_type: app
install_method: dmg
mount_path: /Volumes/Sublime\ Text/
vars_files:
- ../setup-vars.yaml
- ../setup-vars.yml
tasks:
- include: ../setup.yaml
- include: ../install/$install_method.yaml
- 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
- name: Create symlink sublime for Sublime Text's subl command

14
apps/transmit.yml Normal file
View file

@ -0,0 +1,14 @@
---
- hosts: {{ hosts }}
user: {{ user }}
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
tasks:
- include: ../setup.yml
- include: ../install/{{ install_method }}.yml

16
apps/vagrant.yml Normal file
View file

@ -0,0 +1,16 @@
---
- hosts: {{ hosts }}
user: {{ user }}
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
mount_path: /Volumes/Vagrant/
vars_files:
- ../setup-vars.yml
tasks:
- include: ../setup.yml
- include: ../install/{{ install_method }}.pkg

17
apps/virtualbox.yml Normal file
View file

@ -0,0 +1,17 @@
---
- include: ../setup.yml
- hosts: {{ hosts }}
user: {{ user }}
vars:
app_name: VirtualBox
app_name_pretty: VirtualBox
app_url: "http://download.virtualbox.org/virtualbox/4.3.6/VirtualBox-4.3.6-91406-OSX.dmg"
mount_path: /Volumes/VirtualBox/
installer_type: pkg
install_method: dmg
install_target: /Volumes/OSX
vars_files:
- ../setup-vars.yml
tasks:
- include: ../install/{{ install_method }}.yml

15
apps/vlc.yml Normal file
View file

@ -0,0 +1,15 @@
---
- hosts: {{ hosts }}
user: {{ user }}
vars:
app_name: VLC
app_name_pretty: VLC
app_url: "http://get.videolan.org/vlc/2.1.3/macosx/vlc-2.1.3.dmg"
installer_type: app
install_method: dmg
mount_path: /Volumes/vlc-2.1.3/
vars_files:
- ../setup-vars.yml
tasks:
- include: ../setup.yml
- include: ../install/{{ install_method }}.yml

View file

@ -1,19 +0,0 @@
---
# - include: vlc/vlc.yaml
# - include: transmission/transmission.yaml
# - include: appcleaner/appcleaner.yaml
# - include: keka/keka.yaml
# - include: limechat/limechat.yaml
# - include: firefox/firefox.yaml
# - include: opera/opera.yaml
# - include: mou/mou.yaml
# - include: texts/texts.yaml
# - include: sublime-text/sublime-text.yaml
# - include: sourcetree/sourcetree.yaml
# - include: sequel-pro/sequel-pro.yaml
# - include: alfred/alfred.yaml
# - include: google-chrome/google-chrome.yaml
# - include: brackets/brackets.yaml
# - include: trim-enabler/trim-enabler.yaml
# - include: iterm/iterm.yaml
- include: handbrake/handbrake.yaml

View file

@ -1,4 +0,0 @@
Firefox
=======
This Ansible playbook installs Firefox, an advanced Gecko based web browser.

View file

@ -1,16 +0,0 @@
---
- hosts: $hosts
user: $user
sudo: yes
vars:
app_name: Firefox
app_name_pretty: Firefox
app_url: https://download.mozilla.org/?product=firefox-20.0&os=osx&lang=en-US
installer_type: app
install_method: dmg
mount_path: /Volumes/Firefox/
vars_files:
- ../setup-vars.yaml
tasks:
- include: ../setup.yaml
- include: ../install/$install_method.yaml

View file

@ -1,4 +0,0 @@
Google Chrome
=============
This Ansible playbook installs Google Chrome, a fast, secure, and extensible WebKit web browser.

View file

@ -1,16 +0,0 @@
---
- hosts: $hosts
user: $user
sudo: yes
vars:
app_name: Google\ Chrome
app_name_pretty: Google Chrome
app_url: https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg
installer_type: app
install_method: dmg
mount_path: /Volumes/Google\ Chrome/
vars_files:
- ../setup-vars.yaml
tasks:
- include: ../setup.yaml
- include: ../install/$install_method.yaml

View file

@ -1,4 +0,0 @@
HandBrake
=========
This Ansible playbook installs HandBrake, a fully featured and flexible video transcoder implimenting the x.264 codec.

View file

@ -1,16 +0,0 @@
---
- hosts: $hosts
user: $user
sudo: yes
vars:
app_name: HandBrake
app_name_pretty: HandBrake
app_url: http://handbrake.fr/rotation.php?file=HandBrake-0.9.8-MacOSX.6_GUI_x86_64.dmg
installer_type: app
install_method: dmg
mount_path: /Volumes/HandBrake-0.9.8-MacOSX.6_GUI_x86_64/
vars_files:
- ../setup-vars.yaml
tasks:
- include: ../setup.yaml
- include: ../install/$install_method.yaml

View file

@ -1,11 +0,0 @@
---
- include: ../local-setup.yaml
- hosts: $hosts
user: $user
gather_facts: false
vars_files:
- ../local-setup-vars.yaml
tasks:
- name: Run Homebrew install script
command: ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"

View file

@ -1,5 +0,0 @@
---
- 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

5
install/app.yml Normal file
View file

@ -0,0 +1,5 @@
---
- 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 }}

View file

@ -1,16 +0,0 @@
---
- name: Download $app_name_pretty
get_url: url=$app_url dest=$downloads/$app_name.dmg
- 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'
- name: Install $app_name_pretty pkg
command: sudo installer -package $mount_path$app_name.pkg -target $install_target
when_string: $installer_type == 'pkg'
- name: Unmount $app_name_pretty image
command: hdiutil detach $mount_path

16
install/dmg.yml Normal file
View file

@ -0,0 +1,16 @@
---
- name: Download {{ app_name_pretty }}
get_url: url={{ app_url }} dest={{ downloads }}/{{ app_name }}.dmg
- 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'
- name: Install {{ app_name_pretty }} pkg
command: sudo installer -package {{ mount_path }}{{ app_name }}.pkg -target {{ install_target }}
when_string: {{ installer_type }} == 'pkg'
- name: Unmount {{ app_name_pretty }} image
command: hdiutil detach {{ mount_path }}

View file

@ -1,3 +0,0 @@
---
- name: Install $app_name_pretty via Homebrew
homebrew: name=$app_name state=installed update_homebrew=yes

3
install/homebrew.yml Normal file
View file

@ -0,0 +1,3 @@
---
- name: Install {{ app_name_pretty }} via Homebrew
homebrew: name={{ app_name }} state=installed update_homebrew=yes

View file

View file

@ -1,3 +0,0 @@
---
- name: Install $app_name pkg
command: sudo installer -package $app_name.pkg -target $install_target

3
install/pkg.yml Normal file
View file

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

View file

@ -1,20 +0,0 @@
---
- name: Download $app_name_pretty
get_url: url=$app_url dest=$downloads/$app_name.tar
- name: Remove existing extraction directory if present
file: path=$downloads$app_name/ state=absent
- name: Create an extraction directory
file: path=$downloads$app_name/ state=directory
- name: Extract $app_name_pretty tarball
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'
- 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'
- 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'
- name: Remove extraction directory
file: path=$downloads$app_name/ state=absent

20
install/tar.yml Normal file
View file

@ -0,0 +1,20 @@
---
- name: Download {{ app_name_pretty }}
get_url: url={{ app_url }} dest={{ downloads }}/{{ app_name }}.tar
- name: Remove existing extraction directory if present
file: path={{ downloads }}{{ app_name }}/ state=absent
- name: Create an extraction directory
file: path={{ downloads }}{{ app_name }}/ state=directory
- name: Extract {{ app_name_pretty }} tarball
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'
- 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'
- 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'
- name: Remove extraction directory
file: path={{ downloads }}{{ app_name }}/ state=absent

View file

@ -1,20 +0,0 @@
---
- name: Download $app_name_pretty
get_url: url=$app_url dest=$downloads/$app_name.zip
- name: Remove existing extraction directory if present
file: path=$downloads$app_name/ state=absent
- name: Create an extraction directory
file: path=$downloads$app_name/ state=directory
- name: Extract $app_name_pretty zip archive
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'
- 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'
- 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'
- name: Remove extraction directory
file: path=$downloads$app_name/ state=absent

20
install/zip.yml Normal file
View file

@ -0,0 +1,20 @@
---
- name: Download {{ app_name_pretty }}
get_url: url={{ app_url }} dest={{ downloads }}/{{ app_name }}.zip
- name: Remove existing extraction directory if present
file: path={{ downloads }}{{ app_name }}/ state=absent
- name: Create an extraction directory
file: path={{ downloads }}{{ app_name }}/ state=directory
- name: Extract {{ app_name_pretty }} zip archive
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'
- 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'
- 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'
- name: Remove extraction directory
file: path={{ downloads }}{{ app_name }}/ state=absent

11
main.yml Normal file
View file

@ -0,0 +1,11 @@
---
- include: apps/chrome.yml
- include: apps/firefox.yml
- include: apps/handbrake.yml
- include: apps/homebrew.yml
- include: apps/sequel-pro.yml
- include: apps/sublime.yml
- include: apps/transmit.yml
- include: apps/vagrant.yml
- include: apps/virtualbox.yml
- include: apps/vlc.yml

View file

@ -1,4 +0,0 @@
Sequel Pro
==========
This Ansible playbook installs Sequel Pro, a feature rich and powerful MySQL database inspector/manager.

View file

@ -1,15 +0,0 @@
---
- hosts: $hosts
user: $user
vars:
app_name: Sequel\ Pro
app_name_pretty: Sequel Pro
app_url: http://sequel-pro.googlecode.com/files/sequel-pro-1.0.1.dmg
installer_type: app
install_method: dmg
mount_path: /Volumes/Sequel\ Pro\ 1.0.1/
vars_files:
- ../setup-vars.yaml
tasks:
- include: ../setup.yaml
- include: ../install/$install_method.yaml

View file

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

View file

@ -1,4 +0,0 @@
Sublime Text
============
This Ansible playbook installs Sublime Text, a powerfull, performant, extensable, and versitile code editor. It also sets up `subl` and `sublime` symlinks in your `/usr/bin/` directory for the highly useful Sublime Text `subl` command.

View file

@ -1,4 +0,0 @@
Transmit
========
This Ansible playbook installs Transmit, an extremely fast and high performing FTP client.

View file

@ -1,15 +0,0 @@
---
- hosts: $hosts
user: $user
sudo: yes
vars:
app_name: Transmit
app_name_pretty: Transmit
app_url: http://www.panic.com/transmit/d/Transmit%204.3.3.zip
installer_type: app
install_method: zip
vars_files:
- ../setup-vars.yaml
tasks:
- include: ../setup.yaml
- include: ../install/$install_method.yaml

View file

@ -1,4 +0,0 @@
Vagrant
=======
This Ansible playbook installs Vagrant, an powerful tool which automates virtualization and provisionment.

View file

@ -1,17 +0,0 @@
---
- include: ../setup.yaml
- hosts: $hosts
user: $user
vars:
app_name: Vagrant
app_name_pretty: Vagrant
app_url: http://files.vagrantup.com/packages/64e360814c3ad960d810456add977fd4c7d47ce6/Vagrant.dmg
installer_type: pkg
install_method: dmg
install_target: /Volumes/OSX
mount_path: /Volumes/Vagrant/
vars_files:
- ../setup-vars.yaml
tasks:
- include: ../install/$install_method.pkg

View file

@ -1,4 +0,0 @@
VirtualBox
==========
This Ansible playbook installs VirtualBox, a home and enterprise virtualization software package.

View file

@ -1,17 +0,0 @@
---
- include: ../setup.yaml
- hosts: $hosts
user: $user
vars:
app_name: VirtualBox
app_name_pretty: VirtualBox
app_url: http://download.virtualbox.org/virtualbox/4.2.12/VirtualBox-4.2.12-84980-OSX.dmg
mount_path: /Volumes/VirtualBox/
installer_type: pkg
install_method: dmg
install_target: /Volumes/OSX
vars_files:
- ../setup-vars.yaml
tasks:
- include: ../install/$install_method.yaml

View file

@ -1,4 +0,0 @@
VLC
===
This Ansible playbook installs VLC, a lightweigt and versitile media player for Mac, Linux, and Windows, and will eventually have the ability to make it the default file handler for specified file types.

View file

@ -1,16 +0,0 @@
---
- hosts: $hosts
user: $user
sudo: yes
vars:
app_name: VLC
app_name_pretty: VLC
app_url: https://copy.com/8WKZ3x1ZWOIC/VLC-2.0.6.dmg?download=1
installer_type: app
install_method: dmg
mount_path: /Volumes/vlc-2.0.6/
vars_files:
- ../setup-vars.yaml
tasks:
- include: ../setup.yaml
- include: ../install/$install_method.yaml