Razique Mahroua
2020-03-18 b85c91a8192593f6b62f93e11c971868964343a9
commit | author | age
93d261 1 # Ansible Role: Node.js
SS 2
3 [![Build Status](https://travis-ci.org/geerlingguy/ansible-role-nodejs.svg?branch=master)](https://travis-ci.org/geerlingguy/ansible-role-nodejs)
4
5 Installs Node.js on RHEL/CentOS or Debian/Ubuntu.
6
7 ## Requirements
8
9 Requires the EPEL repository on RedHat/CentOS (you can install it by simply adding the `geerlingguy.repo-epel` role to your playbook).
10
11 ## Role Variables
12
13 Available variables are listed below, along with default values (see `defaults/main.yml`):
14
15     nodejs_version: "6.x"
16
17 The Node.js version to install. "6.x" is the default and works on most supported OSes. Other versions such as "0.12", "4.x", "5.x", "6.x", etc. should work on the latest versions of Debian/Ubuntu and RHEL/CentOS.
18
8fa982 19     nodejs_install_npm_user: "{{ ansible_user }}"
93d261 20
SS 21 The user for whom the npm packages will be installed can be set here, this defaults to `ansible_user`.
22
23     npm_config_prefix: "~/.npm-global"
24
25 The global installation directory. This should be writeable by the `nodejs_install_npm_user`.
26
27     npm_config_unsafe_perm: "false"
28
29 Set to true to suppress the UID/GID switching when running package scripts. If set explicitly to false, then installing as a non-root user will fail.
30
31     nodejs_npm_global_packages: []
32
33 A list of npm packages with a `name` and (optional) `version` to be installed globally. For example:
34
35     nodejs_npm_global_packages:
36       # Install a specific version of a package.
37       - name: jslint
38         version: 0.9.3
39       # Install the latest stable release of a package.
40       - name: node-sass
41 <!-- code block separator -->
42
43     nodejs_package_json_path: ""
44
45 Set a path pointing to a particular `package.json` (e.g. `"/var/www/app/package.json"`). This will install all of the defined packages globally using Ansible's `npm` module.
46
47 ## Dependencies
48
49 None.
50
51 ## Example Playbook
52
53     - hosts: utility
ae6f44 54       vars_files: 
93d261 55         - vars/main.yml
SS 56       roles:
57         - geerlingguy.nodejs
58
59 *Inside `vars/main.yml`*:
60
61     nodejs_npm_global_packages:
62       - name: jslint
63       - name: node-sass
64
65 ## License
66
67 MIT / BSD
68
69 ## Author Information
70
71 This role was created in 2014 by [Jeff Geerling](https://www.jeffgeerling.com/), author of [Ansible for DevOps](https://www.ansiblefordevops.com/).