Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ecgalaxy/nodejs
Ansible role which installs Node.js - Repository mirror - development takes place on code.europa.eu
https://github.com/ecgalaxy/nodejs
ansible-role nodejs npm yarn
Last synced: 1 day ago
JSON representation
Ansible role which installs Node.js - Repository mirror - development takes place on code.europa.eu
- Host: GitHub
- URL: https://github.com/ecgalaxy/nodejs
- Owner: ecgalaxy
- License: eupl-1.2
- Created: 2022-02-01T16:13:47.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2024-08-12T12:46:58.000Z (3 months ago)
- Last Synced: 2024-08-12T14:12:42.739Z (3 months ago)
- Topics: ansible-role, nodejs, npm, yarn
- Language: Jinja
- Homepage: https://code.europa.eu/ecgalaxy/nodejs
- Size: 41 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
ECGALAXY nodejs
===============Ansible role that installs [Node.js](https://nodejs.org/) globally.
Requirements
------------- On Ubuntu, the `gpg-agent` command, which can be provided by `ecgalaxy.common_packages`.
Role Variables
--------------- `nodejs_version`: Sets the Node.js version to install ("18.x", "20.x", etc),
using the distribution package manager.The default version is 20.x.
Optionally, in order to install a specific version from a downloadable archive, set the below variables:
- `nodejs_download_url`: The Node.js archive to download (see https://nodejs.org/dist/)
- `nodejs_checksum`: The archive checksum
- `nodejs_install_path`: The path where Node.js will be installedAbout Node.js 18.x, 20.x, 22.x and 23.x on Amazon Linux 2
---------------------------------------------------------Official Node.js 18.x, 20.x, 22.x and 23.x pre-built binaries cannot be used on Amazon Linux 2,
due to binary incompatibilities (missing glibc symbol versions).AWS recommends to build those Node.js versions from source, when using Amazon Linux 2 (AL2).
Pre-built Node.js 18x, 20.x, 22.x and 23.x binaries for Amazon Linux 2 can be found at
https://code.europa.eu/ecgalaxy/amazonlinux2-nodejs/-/packagesThey are downloaded by this Ansible role (when executed on AL2),
and saved into the `/opt/nodejs/` folder.Symlinks to the Node.js executables are then created in `/usr/local/bin`.
You may want to update your `$PATH` as well, pointing to the `/opt/nodejs//bin` folder.
Usage with `nvm` has been tested successfully; the command `nvm use system` will correctly point to the "global"
Node.js version (saved into `/opt/nodejs/`).You can also execute this role to globally install 18.x, 20.x, 22.x and 23.x then overwrite the contents of
`~/.nvm/versions/node/v` for each, which will allow switching from one version to another
with `nvm use`.Dependencies
------------- optional: ecgalaxy.bootstrap
- optional: ecgalaxy.common_packagesExample Playbook
----------------- hosts: all
roles:
- ecgalaxy.bootstrap
- ecgalaxy.common_packages
- ecgalaxy.nodejsOne-liner
---------To globally install the default Node.js version:
bash <(curl -s https://code.europa.eu/-/snippets/1/raw/main/ansible-role.sh) ecgalaxy.nodejs
To globally install Node.js 22.x:
bash <(curl -s https://code.europa.eu/-/snippets/1/raw/main/ansible-role.sh) ecgalaxy.nodejs --extra-vars '{"nodejs_version":"22.x"}'
See [ansible-role](https://code.europa.eu/-/snippets/1) for instructions.
Please verify the script integrity first.
License
-------Copyright the European Union 2022.
Licensed under the EUPL-1.2 or later.
Author Information
------------------ECGALAXY team.
NOTE: This role is based on [original work by Jeff Geerling](https://github.com/geerlingguy/ansible-role-nodejs).