/ansible-role-nodejs

An Ansible role that installs Node.js.

Primary LanguageJinjaMIT LicenseMIT

nodejs

An Ansible role that installs Node.js use the nodesource repositories.


Codacy grade GitHub Workflow Status GitHub tag (latest by date) MIT License

About

Node.js is a free, open-source, cross-platform JavaScript runtime environment that lets developers create servers, web apps, command line tools and scripts. This role installs Node.js using the nodesource repositories to install the latest Node.js deb/rpm packages typically allowing for the installation of the newer version of Node.js than is available in the default distro repositories. This role can also remove Node.js and the nodesource repositories.

Note: this role does not use the nvm method to install Node.JS.

Requirements

Supported Distros

  • AlmaLinux >= 8
  • AmazonLinux 2023
  • CentOS >= 8
  • Debian >= 10
  • Fedora >= 29
  • OracleLinux >= 8
  • Pop!_OS >= 20.04
  • Redhat Enterprise Linux >= 8
  • Rocky Linux >= 8
  • Ubuntu >= 20.04

Supported Architectures

  • x86_64
  • aarch64
  • armv7l

Note: if there are any more Debian or RedHat Based distros that are supported please let me know.

Role Variables

By default this role will setup Node.js LTS version. You can change the version to current or distro by setting the nodejs_version variable.

  • LTS: Long Term Suport version.
  • Current: Latest version.
  • Distro: Version provided by the distribution.
# nodejs version (lts|current|distro)
nodejs_version: lts
# nodejs state (absent|present)
nodejs_state: present

Dependencies

community.general

Example Playbook

---
- name: Node.js
  hosts: all
  roles:
    - dgibbs64.nodejs

License

MIT

Author Information