debops.nodejs default variables

Upstream configuration


Enable or disable support for NodeSource APT repositories. By default the upstream package will be installed due to no security support in Debian Stable release.

nodejs__upstream: '{{ ansible_local.nodejs.upstream|bool
                      if (ansible_local|d() and ansible_local.nodejs|d() and
                          ansible_local.nodejs.upstream is defined)
                      else True }}'

Specify the NodeJS release to install from the NodeSource APT repository. See for the current release and maintenance shedule. Available releases:

  • node_6.x
  • node_8.x
  • node_10.x
  • iojs_1.x
  • iojs_2.x

If you switch to the iojs release, you need to update the list of installed APT packages manually.

nodejs__upstream_release: 'node_8.x'

GPG fingerprint of APT repository signing key.

nodejs__upstream_key_id: '9FD3B784BC1C6FC31A8A0A1C1655A0AB68576280'

URL of the NodeSource APT repository in sources.list format.

nodejs__upstream_repository: 'deb{{ nodejs__upstream_release }} {{ ansible_distribution_release }} main'

NPM installation via git

The npm package in Debian is unmaintained and has been dropped from Debian Stretch. NPM is installed automatically with upstream version of NodeJS, however if you want to use the distribution version, the role can install NPM system-wide using the project's GitHub repository.

Be aware that the NPM will be installed in /usr prefix using this method, ie. binaries will be in /usr/bin instead of /usr/local/bin, which might lead to conflicts with .deb packages of NPM and/or NodeJS.


Enable or disable NPM installation via the GitHub repository. This should be disabled if upstream NodeJS APT package is installed.

nodejs__npm_git_enabled: '{{ False
                             if (nodejs__upstream|bool or
                                 (ansible_local|d() and ansible_local.nodejs|d() and
                             else True }}'

The source directory where NPM repository will be cloned.

nodejs__npm_git_src: '{{ (ansible_local.root.src
                          if (ansible_local|d() and ansible_local.root|d() and
                          else "/usr/local/src") + "/nodejs" }}'

The URL of the NPM git repository.

nodejs__npm_git_repo: ''

The branch or tag to check out from the NPM git repository. By default the fixed releases will be chedked out if found, otherwise latest NPM release will be installed.

nodejs__npm_git_version: '{{ nodejs__npm_git_version_map[ansible_distribution_release]
                             | d(nodejs__npm_git_release) }}'

YAML dictionary which maps fixed NPM releases to specific OS releases. NPM v6.0.0+ doesn't work with NodeJS 4.x anymore, therefore on OS releases with older NodeJS it is fixed to the last working release.

  'jessie':  'v5.10.0'
  'stretch': 'v5.10.0'
  'xenial':  'v5.10.0'

The default NPM rolling release branch which will install the latest version released by upstream. This version might be upgraded automatically by Ansible runs.

nodejs__npm_git_release: 'latest'

The absolute path where the NPM git repository will be cloned.

nodejs__npm_git_dest: '{{ nodejs__npm_git_src + "/" + nodejs__npm_git_repo.split("://")[1] }}'

Enable or disable updates of the NPM git repository. If updates are detected, the role will reinstall NPM automatically.

nodejs__npm_git_update: False

The command that will be used to install / update NPM. It's executed in the base directory of the NPM git repository.

nodejs__npm_git_install_command: 'bin/npm-cli.js install -g'

Yarn upstream configuration


Enable or disable support for Yarn upstream APT repository.

nodejs__yarn_upstream: '{{ True
                           if (ansible_local|d() and ansible_local.nodejs|d() and
                               ansible_local.nodejs.yarn_upstream is defined and
                           else False }}'

GPG fingerprint of Yarn APT repository signing key.

nodejs__yarn_upstream_key_id: '72ECF46A56B4AD39C907BBB71646B01B86E50310'

URL of the NodeSource APT repository in sources.list format.

nodejs__yarn_upstream_repository: 'deb stable main'

APT packages


List of base APT packages to install.

  - 'nodejs'
  - '{{ "yarn" if nodejs__yarn_upstream|bool else [] }}'

List of APT packages which are only needed when NodeJS is installed from current OS release repositories.

  - '{{ [ "nodejs-legacy" ] if (not nodejs__upstream|bool) else [] }}'

List of APT packages to install on all hosts in Ansible inventory.

nodejs__packages: []

List of APT packages to install ona group of hosts in Ansible inventory.

nodejs__group_packages: []

List of APT packages to install on specific hosts in Ansible inventory.

nodejs__host_packages: []

List of APT packages to install specified by other Ansible roles.

nodejs__dependent_packages: []

NPM packages

You can use the lists below to install NPM packages. Each element of a list is either a NPM package name, or a YAML dictionary with parameters supported by the npm Ansible module. See that module documentation for list of supported parameters. An example:

  - 'bower'

  - name: 'gulp'
    version: '3'

List of NPM packages to install on all hosts in Ansible inventory.

nodejs__npm_packages: []

List of NPM packages to install on a group of hosts in Ansible inventory.

nodejs__npm_group_packages: []

List of NPM packages to install on specific hosts in Ansible inventory.

nodejs__npm_host_packages: []

List of NPM packages to install specified by other Ansible roles.

nodejs__npm_dependent_packages: []

If production mode is not specified for an NPM package, the default value set here will be used instead. By default role does no install development dependencies of a given package. You can override this value using item.production parameter.

nodejs__npm_production_mode: True

Configuration for other Ansible roles


Configuration for the debops.apt_preferences Ansible role.


  - packages: [ 'nodejs', 'nodejs-*', 'node-*', 'libssl1.0.0', 'libssl-dev' ]
    backports: [ 'jessie' ]
    reason: 'Unsupported NodeJS version, parity with next Debian release'
    by_role: 'debops_nodejs'
    filename: 'debops_nodejs.pref'
    state: '{{ "absent" if nodejs__upstream|bool else "present" }}'