/ansible-nvm-nodejs

An Ansible role that installs NVM and Node.js, in the format for Ansible Galaxy (deprecated)

Primary LanguageShellApache License 2.0Apache-2.0

williamyeh.nvm-nodejs for Ansible Galaxy

[Deprecated!!] Use williamyeh.nodejs instead.

Summary

Role name in Ansible Galaxy: williamyeh.nvm-nodejs

This Ansible role has the following features for NVM & Node.js:

  • Install specific version of NVM.
  • Install specific version of Node.js (including io.js) via NVM.

This role will install NVM globally. If you prefer NVM being installed on a per-user basis (i.e., on $HOME/.nvm directory of each user), try alternatives such as g-div/ansible-nvm.

Role Variables

Mandatory variables

Variables needed to be defined in user's playbook:

nodejs_version

For example:

nodejs_version: "v0.10.35"

Use nvm ls-remote command to get a list of valid version strings.

Optional variables

User-configurable defaults:

# parent path of NVM to be installed on
nvm_parent_path:   /opt

# path of NVM to be installed on;
# never override it unless absolutely necessary!
nvm_install_path:  "{{ nvm_parent_path }}/nvm"

Usage

Step 1: add role

Add role name williamyeh.nvm-nodejs to your playbook file.

Step 2: add variables

Set vars in your playbook file.

Simple example:

---
# file: simple-playbook.yml

- hosts: all

  roles:
    - williamyeh.nvm-nodejs

  vars:
    nodejs_version: "v0.10.35"

Dependencies

None.

License

Licensed under the Apache License V2.0. See the LICENSE file for details.

History

Rewritten from my pre-Galaxy version: server-config-template.

During refactoring, some roles on Ansible Galaxy also inspired me: