William-Yeh.nodejs
williamyeh.nodejs for Ansible Galaxy
Summary
Role name in Ansible Galaxy: williamyeh.nodejs
This Ansible role has the following features for Node.js:
- Install specific version of Node.js (io.js is only supported under Debian/Ubuntu).
Role Variables
Mandatory variables
None.
Optional variables
Pick one version to install:
# Node.js version; e.g., "5", "4.0", "0.12", "0.12.7"
# Both numeric and string forms are ok.
nodejs_version
# io.js version; e.g., "3.3"
# NOTE: only available under Debian/Ubuntu.
iojs_version
If neither nodejs_version nor iojs_version is defined, nodejs_version is defined automatically by tasks/set-role-variables.yml according to defaults/main.yml settings:
nodejs_default_in_aptfor Debian/Ubuntu.nodejs_default_in_yumfor CentOS.
Other user-configurable defaults:
# install tools for compiling native addons from npm?
nodejs_compile: True
Usage
Step 1: add role
Add role name williamyeh.nodejs to your playbook file.
Step 2: add variables
Set vars in your playbook file.
Simple example:
---
# file: simple-playbook.yml
- hosts: all
become: True
roles:
- williamyeh.nodejs
vars:
nodejs_version: 4.0
Dependencies
None.
License
Licensed under the MIT License. See the LICENSE file for details.
History
1.0 : Use Ansible 2.0 syntax; support up to Node.js 5.x.
Initial commit (2015-05-08): From now on, the role installs Node.js from NodeSource binary distributions.
Older versions are based on NVM:
Rewritten from my pre-Galaxy version server-config-template and Galaxy version ansible-nvm-nodejs.
During refactoring, some roles on Ansible Galaxy also inspired me:
- leonidas.nvm forks, especially ahmednuaman.nvm-ahmed and then g-div/ansible-nvm
ansible-galaxy install William-Yeh.nodejs