community.general.npm – Manage node.js packages with npm¶
Note
This plugin is part of the community.general collection (version 2.5.1).
To install it use: ansible-galaxy collection install community.general
.
To use it in a playbook, specify: community.general.npm
.
Requirements¶
The below requirements are needed on the host that executes this module.
npm installed in bin path (recommended /usr/local/bin)
Parameters¶
Examples¶
- name: Install "coffee-script" node.js package.
community.general.npm:
name: coffee-script
path: /app/location
- name: Install "coffee-script" node.js package on version 1.6.1.
community.general.npm:
name: coffee-script
version: '1.6.1'
path: /app/location
- name: Install "coffee-script" node.js package globally.
community.general.npm:
name: coffee-script
global: yes
- name: Remove the globally package "coffee-script".
community.general.npm:
name: coffee-script
global: yes
state: absent
- name: Install "coffee-script" node.js package from custom registry.
community.general.npm:
name: coffee-script
registry: 'http://registry.mysite.com'
- name: Install packages based on package.json.
community.general.npm:
path: /app/location
- name: Update packages based on package.json to their latest version.
community.general.npm:
path: /app/location
state: latest
- name: Install packages based on package.json using the npm installed with nvm v0.10.1.
community.general.npm:
path: /app/location
executable: /opt/nvm/v0.10.1/bin/npm
state: present
Authors¶
Chris Hoffman (@chrishoffman)