Skip to content

claranet/ansible-role-nodejs

Repository files navigation

Ansible role - nodejs

Maintainer License Release Status Ansible version Ansible Galaxy

⭐ Star us on GitHub — it motivates us a lot!

Install and configure NodeJS

⚠️ Requirements

Ansible >= 2.10

⚡ Installation

ansible-galaxy install claranet.nodejs

⚙️ Role variables

Variable Default value Required  Description
nodejs_version undef true version of nodejs to install. It can be short : "16" or long : "16.11"
nodejs_npm {} false  list of npm packages to install
nodejs_uses_debian_repository false false  Whether to use the Debian repository or not. It will intall from debian file package by default
nodejs_proxy_settings_https_proxy  '' false proxy to use to get https links. Ex: https://proxy:3128
nodejs_proxy_settings_http_proxy  '' false proxy to use to get http links. Ex: https://proxy:3128

If using the short nodejs_version (ex: 16), it will use the NodeSource repository.

If using the short nodejs_version (ex: 16) AND nodejs_uses_debian_repository is true, it will use the Debian Repository.

If using the long nodejs version, it will download the package from NodeSource and install it with dpkg (not all packages are available directly from the repository).

🔄 Dependencies

N/A

✏️ Example Playbook

  • Install using deb files
---
- name: Install NodeJS With deb files
  hosts: all
  vars:
    nodejs_version: "16.17.1"
    nodejs_npm:
      coffeescript: {}
      chance:
        version: "1.1.3"
      enzyme:
        state: absent
    nodejs_proxy_settings_https_proxy: "https://proxy:3128"
    nodejs_proxy_settings_http_proxy: "https://proxy:3128"
  roles:
    - claranet.nodejs
  • Install using apt repository
---
- name: Install NodeJS With deb files
  hosts: all
  vars:
    nodejs_version: "16"
    nodejs_uses_debian_repository: true
    nodejs_npm:
      coffeescript: {}
      chance:
        version: "1.1.3"
      enzyme:
        state: absent
    nodejs_proxy_settings_https_proxy: "https://proxy:3128"
    nodejs_proxy_settings_http_proxy: "https://proxy:3128"
  roles:
    - claranet.nodejs

©️ License

Mozilla Public License Version 2.0