---
- name: Add the NodeSource APT key
  apt_key: url=https://deb.nodesource.com/gpgkey/nodesource.gpg.key state=present

- name: Add the NodeSource repo
  apt_repository: repo="deb https://deb.nodesource.com/node {{ ansible_distribution_release }} main" state=present

- name: Install Node.js
  apt: name=nodejs state=present


---
- name: Add the NodeSource APT key
  apt_key: url=https://deb.nodesource.com/gpgkey/nodesource.gpg.key state=present

- name: Remove Chris Lea's old PPA
  apt_repository: repo="ppa:chris-lea/node.js" state=absent

- name: Add the NodeSource repo
  apt_repository: repo="deb https://deb.nodesource.com/node {{ ansible_distribution_release }} main" state=present

- name: Install Node.js
  apt: name=nodejs state=present


Make sure old Node repo is gone.
Make sure old Node repo is gone.
