How to install NodeJS on Debian/Ubuntu systems using Ansible

NodeJS, Ansible, Ubuntu

Since I've had to figure out how to do this twice now, and the NodeSource instructions make this more confusing than it ought to be. Make sure you replace node_6.x with the appropriate version from the installation instructions and xenial with the results of lsb_release -s -c.

- name: NodeSource package key
    state: present
- name: NodeSource repository
    repo: 'deb xenial main'
- name: Install NodeJS
    state: present
    name: nodejs