debops.nodejs default variables

Upstream configuration

nodejs__upstream

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 }}'
nodejs__upstream_release

Specify the NodeJS release to install from the NodeSource APT repository. See https://github.com/nodejs/Release 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'
nodejs__upstream_key_id

GPG fingerprint of APT repository signing key.

nodejs__upstream_key_id: '9FD3B784BC1C6FC31A8A0A1C1655A0AB68576280'
nodejs__upstream_repository

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

nodejs__upstream_repository: 'deb https://deb.nodesource.com/{{ 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.

nodejs__npm_git_enabled

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
                                  (ansible_local.nodejs.configured|d())|bool))
                             else True }}'
nodejs__npm_git_src

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
                              ansible_local.root.src|d())
                          else "/usr/local/src") + "/nodejs" }}'
nodejs__npm_git_repo

The URL of the NPM git repository.

nodejs__npm_git_repo: 'https://github.com/npm/npm'
nodejs__npm_git_version

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) }}'
nodejs__npm_git_version_map

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.

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

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'
nodejs__npm_git_dest

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] }}'
nodejs__npm_git_update

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

nodejs__npm_git_update: False
nodejs__npm_git_install_command

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

nodejs__yarn_upstream

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
                               ansible_local.nodejs.yarn_upstream|bool)
                           else False }}'
nodejs__yarn_upstream_key_id

GPG fingerprint of Yarn APT repository signing key.

nodejs__yarn_upstream_key_id: '72ECF46A56B4AD39C907BBB71646B01B86E50310'
nodejs__yarn_upstream_repository

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

nodejs__yarn_upstream_repository: 'deb https://dl.yarnpkg.com/debian/ stable main'

APT packages

nodejs__base_packages

List of base APT packages to install.

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

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

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

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

nodejs__packages: []
nodejs__group_packages

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

nodejs__group_packages: []
nodejs__host_packages

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

nodejs__host_packages: []
nodejs__dependent_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:

nodejs__npm_packages:
  - 'bower'

  - name: 'gulp'
    version: '3'
nodejs__npm_packages

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

nodejs__npm_packages: []
nodejs__npm_group_packages

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

nodejs__npm_group_packages: []
nodejs__npm_host_packages

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

nodejs__npm_host_packages: []
nodejs__npm_dependent_packages

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

nodejs__npm_dependent_packages: []
nodejs__npm_production_mode

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

nodejs__apt_preferences__dependent_list

Configuration for the debops.apt_preferences Ansible role.

nodejs__apt_preferences__dependent_list:

  - 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" }}'