Getting started

NodeJS and NPM from Debian Backports

On a given Debian Oldstable release, the role will install the nodejs and npm packages from the backports repository of the same OS release to ensure feature parity between the Oldstable and Stable Debian releases. This means that, for example, on Debian Stretch the role will use the Node.js and NPM packages from the stretch-backports repository instead of the OS release repository.

Newer Node.js and NPM packages can be installed using the NodeSource repository, which can be enabled using the nodejs__node_upstream variable.

Example inventory

To configure a Node.js environment on a given host or set of hosts, they need to be added to [debops_service_nodejs] Ansible group in the inventory:


Example playbook

If you are using this role without DebOps, here's an example Ansible playbook that uses the debops.nodejs role:


- name: Manage NodeJS environment
  hosts: [ 'debops_service_nodejs', 'debops_nodejs' ]
  become: True

  environment: '{{ inventory__environment | d({})
                   | combine(inventory__group_environment | d({}))
                   | combine(inventory__host_environment  | d({})) }}'


    - role: debops.keyring
      tags: [ 'role::keyring', 'skip::keyring', 'role::nodejs' ]
        - '{{ nodejs__keyring__dependent_apt_keys }}'

    - role: debops.apt_preferences
      tags: [ 'role::apt_preferences', 'skip::apt_preferences' ]
        - '{{ nodejs__apt_preferences__dependent_list }}'

    - role: debops.nodejs
      tags: [ 'role::nodejs', 'skip::nodejs' ]