---

- name: Prepare Statsd directory
  file: state=directory path={{statsd_home}}

- name: Install statsd
  npm: name=statsd path={{statsd_home}}

- name: Configure upstart
  template: src=upstart.conf.j2 dest=/etc/init/statsd.conf
  notify:
  - statsd restart

- name: Configure statsd
  template: src=statsd.js.j2 dest={{statsd_home}}/config.js
  notify:
  - statsd restart

- name: Ensure that Statsd is started
  service: name=statsd state=started enabled=yes

---

- name: install npm
  apt:  pkg=npm state=present update_cache=true
  
- name: Prepare Statsd directory
  file: state=directory path={{statsd_home}}

- name: Install statsd
  npm: name=statsd path={{statsd_home}}

- name: Configure upstart
  template: src=upstart.conf.j2 dest=/etc/init/statsd.conf
  notify:
  - statsd restart

- name: Configure statsd
  template: src=statsd.js.j2 dest={{statsd_home}}/config.js
  notify:
  - statsd restart

- name: Ensure that Statsd is started
  service: name=statsd state=started enabled=yes

Make sure npm is installed
Make sure npm is installed

The ansible npm module needs either the ansible extras package or npm itself in order to work