---
- name: Add apt-key
  apt_key: id=E56151BF keyserver=keyserver.ubuntu.com state=present

- name: Add Mesosphere repo
  apt_repository: repo="{{marathon_apt_repo}}" state=present

- name: Install Marathon package
  apt: pkg={{ marathon_apt_package }} state=present update_cache=yes
  notify: Restart marathon

---
- name: Add apt-key
  apt_key: id=E56151BF keyserver=keyserver.ubuntu.com state=present

- name: Add Mesosphere repo
  apt_repository: repo="{{marathon_apt_repo}}" state=present update_cache=yes

- name: Install Marathon package
  apt: pkg={{ marathon_apt_package }} state=present
  notify: Restart marathon

Update cache after adding the repository, not before installing the package
Update cache after adding the repository, not before installing the package
