Skip to content

Instantly share code, notes, and snippets.

@deluan
Last active February 20, 2016 19:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deluan/aeb28794e9981a345ee4 to your computer and use it in GitHub Desktop.
Save deluan/aeb28794e9981a345ee4 to your computer and use it in GitHub Desktop.
Upgrade Subsonic on Mac OS X
- hosts: all
gather_facts: no
vars:
- release_tag: "{{latest_release.stdout}}"
- repository: EugeneKay/subsonic
- war_name: subsonic-{{release_tag}}.war
- release_url: https://github.com/{{repository}}/releases/download/{{release_tag}}/{{war_name}}
- app_path: /Applications/Subsonic.app
- war_path: "{{app_path}}/Contents/Resources"
- jetty_cache_path: "/Library/Application Support/Subsonic/jetty"
tasks:
- name: find latest release
shell: curl -sSL 'https://api.github.com/repos/{{repository}}/releases' | /usr/local/bin/jq '.[0].tag_name' | tr -d '"'
changed_when: False
register: latest_release
- debug: var=latest_release.stdout
- name: download new version
get_url: url={{release_url}} dest={{war_path}}
notify:
- remove jetty cache
- restart subsonic
- name: link new app
file: name={{war_path}}/subsonic.war src={{war_path}}/{{war_name}} state=link
notify:
- remove jetty cache
- restart subsonic
handlers:
- name: remove jetty cache
file: path={{jetty_cache_path}} state=absent
- name: restart subsonic
shell: pkill -f Subsonic; open -a Subsonic.app
@deluan
Copy link
Author

deluan commented Feb 20, 2016

Run with:
ansible-playbook subsonic_upgrade.yml -i server_address,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment