diff --git a/README.md b/README.md index 0405d12..793d44e 100644 --- a/README.md +++ b/README.md @@ -16,16 +16,18 @@ This is very much a work in progress, and is mostly a means for me to document m ### General changes: - - Fix TODOs (idempotence, mostly) + - Fix TODOs (idempotence, mostly - maybe just pass in a 'creates' variable) ### Applications/packages to be added: - - Cornerstone SVN - - Tower (Git) - - MenuMeters - - nvAlt + - [MacVim](https://github.com/b4winckler/macvim/releases/download/snapshot-72/MacVim-snapshot-72-Mavericks.tbz) + - iShowU HD + - [MenuMeters](http://www.ragingmenace.com/software/menumeters/) + - TextMate 2 - PCKeyboardHack - My dotfiles + - TimeMachineEditor + - Skype - etc... ### Settings to be added: @@ -43,6 +45,26 @@ This is very much a work in progress, and is mostly a means for me to document m - Show hard disks, connected servers on desktop - etc... +### Apps only available via the App Store + +I also use the following apps at least once or twice per week, but unfortunately, as the Mac App Store is not able to be controlled 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 application. + + - Tweetbot + - RadarScope + - Pixelmator + - Skitch + - Quick Resizer + - Knock + - 1Password + - DaisyDisk + - Byword + - Aperture + - Pages + - Keynote + - Numbers + +There are a couple other apps I'm leaving out of the list, like Microsoft Word, because I normally don't install them unless I need them; unfortunately, about once a year, I get a document that's so old/strange that I need Word or Powerpoint to open the file. + ## Ansible for DevOps If Ansible piques your interest, please check out the book I'm working on, [Ansible for DevOps](https://leanpub.com/ansible-for-devops), where I actually *do* follow Ansible best practices, and will teach you how to do some other amazing things with Ansible. diff --git a/apps/adium.yml b/apps/adium.yml new file mode 100644 index 0000000..c8724d4 --- /dev/null +++ b/apps/adium.yml @@ -0,0 +1,15 @@ +--- +- hosts: all + connection: local + vars: + app_name: Adium + app_name_pretty: Adium + app_url: "http://downloads.sourceforge.net/project/adium/Adium_1.5.9.dmg?r=&ts=1392301195&use_mirror=softlayer-ams" + installer_type: app + install_method: dmg + mount_path: /Volumes/Adium\ 1.5.9/ + creates: /Applications/Adium.app + downloads: ~/.ansible-downloads/ + + tasks: + - include: ../install/{{ install_method }}.yml \ No newline at end of file diff --git a/apps/chrome.yml b/apps/chrome.yml index 314918a..13fa937 100644 --- a/apps/chrome.yml +++ b/apps/chrome.yml @@ -8,6 +8,7 @@ installer_type: app install_method: dmg mount_path: /Volumes/Google\ Chrome/ + creates: /Applications/Google\ Chrome.app downloads: ~/.ansible-downloads/ tasks: diff --git a/apps/cornerstone.yml b/apps/cornerstone.yml new file mode 100644 index 0000000..113fbb2 --- /dev/null +++ b/apps/cornerstone.yml @@ -0,0 +1,14 @@ +--- +- hosts: all + connection: local + vars: + app_name: Cornerstone + app_name_pretty: Cornerstone + app_url: "http://www.zennaware.com/mint/pepper/orderedlist/downloads/download.php?file=http%3A//www.zennaware.com/cornerstone/downloads/Cornerstone-2.7.11.zip" + installer_type: app + install_method: zip + downloads: ~/.ansible-downloads/ + creates: /Applications/Cornerstone.app + + tasks: + - include: ../install/{{ install_method }}.yml \ No newline at end of file diff --git a/apps/firefox.yml b/apps/firefox.yml index c5fcf9f..c921dff 100644 --- a/apps/firefox.yml +++ b/apps/firefox.yml @@ -9,6 +9,7 @@ install_method: dmg mount_path: /Volumes/Firefox/ downloads: ~/.ansible-downloads/ + creates: /Applications/Firefox.app tasks: - include: ../install/{{ install_method }}.yml \ No newline at end of file diff --git a/apps/handbrake.yml b/apps/handbrake.yml index 4b611ec..d380f09 100644 --- a/apps/handbrake.yml +++ b/apps/handbrake.yml @@ -9,6 +9,7 @@ install_method: dmg mount_path: /Volumes/HandBrake-0.9.9-MacOSX.6_GUI_x86_64/ downloads: ~/.ansible-downloads/ + creates: /Applications/HandBrake.app tasks: - include: ../install/{{ install_method }}.yml \ No newline at end of file diff --git a/apps/homebrew.yml b/apps/homebrew.yml index db978bc..43c4232 100644 --- a/apps/homebrew.yml +++ b/apps/homebrew.yml @@ -1,6 +1,13 @@ --- - hosts: all connection: local + tasks: + - name: Install Xcode CLI tools + shell: /usr/bin/xcode-select --install creates=/usr/bin/gcc + sudo: yes + - name: Run Homebrew install script - shell: ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)" \ No newline at end of file + shell: ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)" creates=/usr/local/bin/brew + register: brew_result + sudo: yes diff --git a/apps/menumeters.yml b/apps/menumeters.yml new file mode 100644 index 0000000..047ed71 --- /dev/null +++ b/apps/menumeters.yml @@ -0,0 +1,17 @@ +--- +# TODO: This uses a custom installer. Might be able to install from source. +- hosts: all + connection: local + vars: + app_name: Menu\ Meters + app_name_pretty: Menu\ Meters + app_url: "http://www.ragingmenace.com/software/download/MenuMeters.dmg" + installer_type: pkg + install_method: dmg + install_target: /Volumes/Macintosh\ HD + mount_path: /Volumes/Menu\ Meters\ 1.6.1/ + creates: /Applications/Menu\ Meters.app + downloads: ~/.ansible-downloads/ + + tasks: + - include: ../install/{{ install_method }}.yml \ No newline at end of file diff --git a/apps/nvalt.yml b/apps/nvalt.yml new file mode 100644 index 0000000..fb1efa5 --- /dev/null +++ b/apps/nvalt.yml @@ -0,0 +1,14 @@ +--- +- hosts: all + connection: local + vars: + app_name: nvALT + app_name_pretty: nvALT + app_url: "http://abyss.designheresy.com/nvaltb/nvalt2.2b106.zip" + installer_type: app + install_method: zip + downloads: ~/.ansible-downloads/ + creates: /Applications/nvALT.app + + tasks: + - include: ../install/{{ install_method }}.yml \ No newline at end of file diff --git a/apps/sequel-pro.yml b/apps/sequel-pro.yml index 744c3c4..f65cc78 100644 --- a/apps/sequel-pro.yml +++ b/apps/sequel-pro.yml @@ -9,6 +9,7 @@ install_method: dmg mount_path: /Volumes/Sequel\ Pro\ 1.0.2/ downloads: ~/.ansible-downloads/ + creates: /Applications/Sequel\ Pro.app tasks: - include: ../install/{{ install_method }}.yml \ No newline at end of file diff --git a/apps/sublime.yml b/apps/sublime.yml index 8b6c7a2..5120674 100644 --- a/apps/sublime.yml +++ b/apps/sublime.yml @@ -9,6 +9,7 @@ install_method: dmg mount_path: /Volumes/Sublime\ Text/ downloads: ~/.ansible-downloads/ + creates: /Applications/Sublime\ Text.app tasks: - include: ../install/{{ install_method }}.yml diff --git a/apps/tower.yml b/apps/tower.yml new file mode 100644 index 0000000..1e42c5f --- /dev/null +++ b/apps/tower.yml @@ -0,0 +1,14 @@ +--- +- hosts: all + connection: local + vars: + app_name: Tower + app_name_pretty: Tower + app_url: "https://macapps.fournova.com/tower1-1060/download" + installer_type: app + install_method: zip + downloads: ~/.ansible-downloads/ + creates: /Applications/Tower.app + + tasks: + - include: ../install/{{ install_method }}.yml \ No newline at end of file diff --git a/apps/transmit.yml b/apps/transmit.yml index 18db2ec..1a5603a 100644 --- a/apps/transmit.yml +++ b/apps/transmit.yml @@ -8,6 +8,7 @@ installer_type: app install_method: zip downloads: ~/.ansible-downloads/ + creates: /Applications/Transmit.app tasks: - include: ../install/{{ install_method }}.yml \ No newline at end of file diff --git a/apps/vagrant.yml b/apps/vagrant.yml index 32181f6..a8f3307 100644 --- a/apps/vagrant.yml +++ b/apps/vagrant.yml @@ -10,6 +10,7 @@ install_target: /Volumes/Macintosh\ HD mount_path: /Volumes/Vagrant/ downloads: ~/.ansible-downloads/ + creates: /Applications/Vagrant/bin/vagrant tasks: - include: ../install/{{ install_method }}.yml \ No newline at end of file diff --git a/apps/virtualbox.yml b/apps/virtualbox.yml index 36da738..b448147 100644 --- a/apps/virtualbox.yml +++ b/apps/virtualbox.yml @@ -10,6 +10,7 @@ install_method: dmg install_target: /Volumes/Macintosh\ HD downloads: ~/.ansible-downloads/ + creates: /Applications/VirtualBox.app tasks: - include: ../install/{{ install_method }}.yml \ No newline at end of file diff --git a/apps/vlc.yml b/apps/vlc.yml index d2af74e..78e5cf5 100644 --- a/apps/vlc.yml +++ b/apps/vlc.yml @@ -9,6 +9,7 @@ install_method: dmg mount_path: /Volumes/vlc-2.1.3/ downloads: ~/.ansible-downloads/ + creates: /Applications/VLC.app tasks: - include: ../install/{{ install_method }}.yml \ No newline at end of file diff --git a/install/dmg.yml b/install/dmg.yml index 99de8b8..e199e2e 100644 --- a/install/dmg.yml +++ b/install/dmg.yml @@ -1,16 +1,24 @@ --- - 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 }} + command: hdiutil attach {{ app_name }}.dmg chdir={{ downloads }} creates={{ creates }} + - name: Copy {{ app_name_pretty }} app to Applications directory - command: cp -R {{ mount_path }}{{ app_name }}.app /Applications creates=/Applications/{{ app_name }}.app + command: cp -R {{ mount_path }}{{ app_name }}.app /Applications creates={{ creates }} when: "installer_type == 'app'" + - name: Install {{ app_name_pretty }} pkg - command: installer -package {{ mount_path }}{{ app_name }}.pkg -target {{ install_target }} + command: installer -package {{ mount_path }}{{ app_name }}.pkg -target {{ install_target }} creates={{ creates }} sudo: yes when: "installer_type == 'pkg'" -# TODO: Idempotence. + +- name: Check if image is mounted + shell: "[ -d {{ mount_path }} ] && echo '1' || echo '0'" + changed_when: false + register: mount_exists + - name: Unmount {{ app_name_pretty }} image - command: hdiutil detach {{ mount_path }} \ No newline at end of file + command: hdiutil detach {{ mount_path }} + when: "mount_exists.stdout == '1'" \ No newline at end of file diff --git a/install/pkg.yml b/install/pkg.yml index 2cb806b..526cd18 100644 --- a/install/pkg.yml +++ b/install/pkg.yml @@ -1,4 +1,4 @@ --- # TODO: Idempotence. - name: Install {{ app_name }} pkg - command: sudo installer -package {{ app_name }}.pkg -target {{ install_target }} \ No newline at end of file + command: sudo installer -package {{ app_name }}.pkg -target {{ install_target }} creates={{ creates }} \ No newline at end of file diff --git a/install/zip.yml b/install/zip.yml index b212685..44739e9 100644 --- a/install/zip.yml +++ b/install/zip.yml @@ -1,20 +1,26 @@ --- - 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: Check if application is already installed. + shell: "[ -f {{ creates }} ] && echo '1' || echo '0'" + changed_when: false + register: installed + - name: Create an extraction directory file: path={{ downloads }}{{ app_name }}/ state=directory + when: "installed.stdout == '1'" + - 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: "installer_type == 'app'" + command: unzip {{ app_name }}.zip -d {{ app_name }}/ chdir={{ downloads }} creates={{ creates }} + - name: Copy {{ app_name_pretty }} app to Applications directory - command: cp -R {{ app_name }}/{{ app_name }}.app /Applications chdir={{ downloads }} + command: cp -R {{ app_name }}/{{ app_name }}.app /Applications chdir={{ downloads }} creates={{ creates }} when: "installer_type == 'app'" + - name: Install {{ app_name_pretty }} pkg - command: sudo installer -package {{ app_name }}/{{ app_name }}.pkg -target {{ install_target }} chdir={{ downloads }} + command: sudo installer -package {{ app_name }}/{{ app_name }}.pkg -target {{ install_target }} chdir={{ downloads }} creates={{ creates }} when: "installer_type == 'pkg'" -- name: Remove extraction directory + +- name: Ensure extraction directory is gone file: path={{ downloads }}{{ app_name }}/ state=absent \ No newline at end of file diff --git a/main.yml b/main.yml index 27e9a9a..cbd3c8a 100644 --- a/main.yml +++ b/main.yml @@ -11,12 +11,17 @@ - name: Create Ansible downloads directory file: path={{ downloads }} state=directory +- include: apps/adium.yml - include: apps/chrome.yml +- include: apps/cornerstone.yml - include: apps/firefox.yml - include: apps/handbrake.yml - include: apps/homebrew.yml +# - include: apps/menumeters.yml +- include: apps/nvalt.yml - include: apps/sequel-pro.yml - include: apps/sublime.yml +- include: apps/tower.yml - include: apps/transmit.yml - include: apps/vagrant.yml - include: apps/virtualbox.yml