debops.nodejs default variables

Global configuration

nodejs__distribution_release

Specify the OS distribution release to use for the upstream APT repositories and other configuration.

nodejs__distribution_release: '{{ ansible_local.core.distribution_release|d(ansible_distribution_release) }}'

Node upstream configuration

nodejs__node_upstream

Enable or disable support for NodeSource APT repositories. On older distribution versions the upstream package will be installed due to no security support.

nodejs__node_upstream: '{{ ansible_local.nodejs.node_upstream
                           |d(nodejs__distribution_release in [ "jessie", "xenial" ]) | bool }}'
nodejs__node_upstream_release

Specify the Node.js release to install from the NodeSource APT repository. See https://github.com/nodejs/Release for the current release and maintenance schedule. Available releases:

  • node_8.x

  • node_10.x

  • node_12.x

nodejs__node_upstream_release: '{{ "node_8.x"
                                   if (nodejs__distribution_release in
                                       [ "wheezy", "jessie", "stretch",
                                         "trusty", "xenial", "bionic" ])
                                   else "node_10.x" }}'
nodejs__node_upstream_key_id

GPG fingerprint of APT repository signing key.

nodejs__node_upstream_key_id: '9FD3B784BC1C6FC31A8A0A1C1655A0AB68576280'
nodejs__node_upstream_repository

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

nodejs__node_upstream_repository: 'deb https://deb.nodesource.com/{{ nodejs__node_upstream_release }} {{ nodejs__distribution_release }} main'

Yarn upstream configuration

nodejs__yarn_upstream

Enable or disable support for Yarn upstream APT repository.

At the moment the yarnpkg package in Debian Buster is broken if Node.js from NodeSource is installed, therefore in that case installation from upstream will be enabled automatically. Ref: https://bugs.debian.org/933229

nodejs__yarn_upstream: '{{ True
                           if nodejs__node_upstream|bool
                           else (ansible_local.nodejs.yarn_upstream
                                 |d(nodejs__distribution_release in
                                    [ "jessie", "stretch", "xenial", "bionic" ])
                           ) }}'
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__remove_packages

List of APT packages to remove before installation of Node.js support.

nodejs__remove_packages:

  # This package collides with the 'yarn' upstream package
  # Ref: https://bugs.debian.org/913997
  - 'cmdtest'

  # Remove the OS release package if Yarn from upstream should be installed
  - '{{ "yarnpkg" if nodejs__yarn_upstream|bool else [] }}'
nodejs__base_packages

List of base APT packages to install.

nodejs__base_packages:
  - 'nodejs'
  - '{{ [] if nodejs__node_upstream|bool else "npm" }}'
  - '{{ "yarn"
        if nodejs__yarn_upstream|bool
        else ([]
              if (nodejs__distribution_release in
                  [ "wheezy", "jessie", "stretch",
                    "trusty", "xenial", "bionic" ])
              else "yarnpkg") }}'
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', 'npm', 'libuv1', 'libuv1-dev' ]
    backports: [ 'jessie', 'stretch' ]
    reason: 'Unsupported NodeJS version, parity with next Debian release'
    by_role: 'debops_nodejs'
    filename: 'debops_nodejs.pref'
    state: '{{ "absent" if nodejs__node_upstream|bool else "present" }}'

  - package: '*'
    pin: 'origin "deb.nodesource.com"'
    priority: '100'
    reason: "Don't upgrade software automatically using packages from external repository"
    role: 'debops.nodejs'
    suffix: '_deb_nodesource_com'
    state: '{{ "present" if nodejs__node_upstream|bool else "absent" }}'

  - packages: [ 'nodejs', 'nodejs-*' ]
    pin: 'origin "deb.nodesource.com"'
    priority: '501'
    reason: 'Prefer nodejs packages from the same repository for consistency'
    role: 'debops.nodejs'
    suffix: '_deb_nodesource_com'
    state: '{{ "present" if nodejs__node_upstream|bool else "absent" }}'
nodejs__keyring__dependent_apt_keys

Configuration for the debops.keyring Ansible role.

nodejs__keyring__dependent_apt_keys:

  - id: '{{ nodejs__node_upstream_key_id }}'
    repo: '{{ nodejs__node_upstream_repository }}'
    state: '{{ "present" if nodejs__node_upstream|bool else "absent" }}'

  - id: '{{ nodejs__yarn_upstream_key_id }}'
    repo: '{{ nodejs__yarn_upstream_repository }}'
    state: '{{ "present" if nodejs__yarn_upstream|bool else "absent" }}'