lean_delivery.nodejs

nodejs role

License Build Status Build Status Galaxy Ansible Ansible

Summary

This role:

  • installs Node.js on EL and Ubuntu.
  • make preparation and install Node.js packages globally.

Requirements

  • Version of the ansible for installation: 2.5
  • Supported OS
    • EL
      • 6
      • 7
    • Ubuntu
      • 16.04
      • 18.04

Role Variables

  • required

    • nodejs_branch - is used to select main nodejs branch to be installed.
      default value is 8.
    • nodejs_version - version of node.js.
      default value is 8*
  • defaults

    • nodejs_apt_key - GPG-key for APT repositories
      default value is https://deb.nodesource.com/gpgkey/nodesource.gpg.key
    • nodejs_apt_url - path to nodejs APT repository
      default value is deb https://deb.nodesource.com/node_{{ nodejs_branch }}.x {{ ansible_distribution_release }} main
    • nodejs_transport - RedHat distribution transport
      default value is {{ ansible_distribution_major_version is version('7', '<') | ternary('http','https') }}
    • nodejs_rpm_key - GPG-key for RPM repositories
      default value is {{ nodejs_transport }}://rpm.nodesource.com/pub/el/NODESOURCE-GPG-SIGNING-KEY-EL
    • nodejs_yum_url - path to nodejs RPM repository
    • build_tools - to compile and install native addons from npm you may also need build tools.
      default value is False.
    • npm_global_user - global packages owner.
      default value is "" (global packages are not installed).
    • npm_global_group - global packages group.
      default value is "" (global packages are not installed).
    • npm_global_directory - global installation directory.
      default value is /usr/local/lib/npm.
    • npm_global_packages - a list of npm packages with a name and a version.
      default value is [].

Dependencies

None.

Example Playbook

- name: "Install node.js on remote hosts"
  hosts: servers

  vars:
    nodejs_branch: 10
    nodejs_version: 10.15.3
    build_tools: True
    npm_global_user: user
    npm_global_group: user
    npm_global_directory: /home/user/.local
    npm_global_packages:
      - lodash
      - name: express
        version: 4.16.0

  roles:
    - role: ansible-role-nodejs

Inventory example

[servers]
127.0.0.1

Install nodejs role

$ ansible-playbook playbook.yml -i inventory

License

Apache

Author Information

authors:

About

Node.js and global packages installation

Install
ansible-galaxy install lean_delivery.nodejs
GitHub repository
License
apache-2.0
Downloads
1.8k
Owner
Simplify by using!