---
- name: deploy latest app code
  hosts: webservers
  remote_user: zoomhub
  tasks:
  - name: update service upstart script
    template: src=roles/web/templates/service.conf.j2
              dest=/etc/init/{{ service }}.conf

  - name: update app source
    git: repo={{ app_repo }} dest={{ app_root }} version={{ app_version }}
         force=no

  - name: npm update
    npm: path={{ app_root }} state=latest

  - name: remove Streamline.js cache
    file: path={{ admin_home}}/.streamline state=absent

  - name: run app
    sudo: yes
    service: name={{ service }} state=restarted
    notify:
      - start redis

  handlers:
  - name: start redis
    sudo: yes
    service: name=redis-server state=started

---
- name: deploy latest app code
  hosts: webservers
  remote_user: zoomhub
  tasks:
  - name: update service upstart script
    sudo: true
    template: src=roles/web/templates/service.conf.j2
              dest=/etc/init/{{ service }}.conf

  - name: update app source
    git: repo={{ app_repo }} dest={{ app_root }} version={{ app_version }}
         force=no

  - name: npm update
    npm: path={{ app_root }} state=latest

  - name: remove Streamline.js cache
    file: path={{ admin_home}}/.streamline state=absent

  - name: run app
    sudo: yes
    service: name={{ service }} state=restarted
    notify:
      - start redis

  handlers:
  - name: start redis
    sudo: yes
    service: name=redis-server state=started

Use `sudo` to update Upstart script
Use `sudo` to update Upstart script
