Facilitate installing arbitrary npm packages.

This commit is contained in:
Brian Lee 2023-10-13 08:48:15 -07:00
parent e835992ef4
commit 85474d8912
3 changed files with 13 additions and 6 deletions

View File

@ -1,6 +1,6 @@
# Ansible Role: nodejs
Install nodejs, npm and yarn packages from the official yarn repositories. Optionally install n from npm repositories for version management.
Install nodejs, npm and yarn packages from the official yarn repositories. Optionally install packages from npm repositories.
Tested on:
@ -16,7 +16,9 @@ None.
```yaml
node_version: node_20.x
n_enabled: yes
npm_packages:
- n
- pnpm
```
See the role [vars](vars/main.yml)

View File

@ -1,3 +1,5 @@
---
node_version: node_20.x
n_enabled: yes # https://github.com/tj/n
npm_packages:
- n # https://github.com/tj/n

View File

@ -11,8 +11,11 @@
state: present
when: ansible_os_family != 'Debian'
- name: Install 'n' package
- name: Install npm requirements
ansible.builtin.npm:
name: n
name: "{{ item }}"
global: yes
when: n_enabled
state: present
loop: "{{ npm_packages }}"
when: npm_packages is defined