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:
[debops_service_nodejs]
hostname
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
collections: [ 'debops.debops', 'debops.roles01',
'debops.roles02', 'debops.roles03' ]
hosts: [ 'debops_service_nodejs' ]
become: True
environment: '{{ inventory__environment | d({})
| combine(inventory__group_environment | d({}))
| combine(inventory__host_environment | d({})) }}'
roles:
- role: keyring
tags: [ 'role::keyring', 'skip::keyring', 'role::nodejs' ]
keyring__dependent_apt_keys:
- '{{ nodejs__keyring__dependent_apt_keys }}'
- role: apt_preferences
tags: [ 'role::apt_preferences', 'skip::apt_preferences' ]
apt_preferences__dependent_list:
- '{{ nodejs__apt_preferences__dependent_list }}'
- role: nodejs
tags: [ 'role::nodejs', 'skip::nodejs' ]