---

- include: install.deb.yml
  when: ansible_pkg_mgr == 'apt' and nodejs_install == 'pkg'

- include: install.yum.yml
  when: ansible_pkg_mgr == 'yum' and nodejs_install == 'pkg'

- include: install.src.yml
  when: nodejs_install == 'src'

# TODO - make it idempotent
- name: Update npm configuration
  shell: 
    npm config set {{ item.key }} {{ item.value }} -g
  with_dict: 
    nodejs_npm_configuration

- name: Install NPM modules
  npm:
    name={{ item.split('=')[0] }}
    global=yes
    version={{ item.split('=')[1] | default('') }}
  with_items: 
    nodejs_npm_modules

---

- include: install.deb.yml
  when: ansible_pkg_mgr == 'apt' and nodejs_install == 'pkg'

- include: install.yum.yml
  when: ansible_pkg_mgr == 'yum' and nodejs_install == 'pkg'

- include: install.src.yml
  when: nodejs_install == 'src'

# TODO - make it idempotent
- name: Update npm configuration
  shell: 
    npm config set {{ item.key }} {{ item.value }} -g
  with_dict: 
    nodejs_npm_configuration

- name: Install NPM modules
  npm:
    name={{ item }}
    global=yes
  with_items: 
    nodejs_npm_modules

Use regular naming convention for the npm package versions
Use regular naming convention for the npm package versions
