- name: add node repo key
  apt_key: url=https://deb.nodesource.com/gpgkey/nodesource.gpg.key

- name: add node repo
  apt_repository: repo='deb https://deb.nodesource.com/node_6.x xenial main'

- name: install node
  apt: name=nodejs

- name: add node repo key
  apt_key: url=https://deb.nodesource.com/gpgkey/nodesource.gpg.key

- name: add node repo
  apt_repository: repo='deb https://deb.nodesource.com/node_8.x xenial main'

- name: install node
  apt: name=nodejs

Update nodeJS to latest version
Update nodeJS to latest version

Update nodeJS to latest version