adding npm role
This commit is contained in:
1
group_vars/all/npm.yml
Normal file
1
group_vars/all/npm.yml
Normal file
@@ -0,0 +1 @@
|
||||
nvm_version: v0.37.2
|
||||
19
roles/npm/tasks/main.yml
Normal file
19
roles/npm/tasks/main.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
- name: Install and configure npm/nvm/yarn
|
||||
tags: npm
|
||||
become: true
|
||||
become_user: "{{ default_user }}"
|
||||
block:
|
||||
- name: Install nvm
|
||||
shell: "curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/{{ nvm_version }}/install.sh | bash"
|
||||
args:
|
||||
creates: "{{ default_user_home }}/.nvm/nvm.sh"
|
||||
|
||||
- name: Install latest node/npm
|
||||
shell: "source {{ default_user_home }}/.nvm/nvm.sh && nvm install node"
|
||||
|
||||
- name: Activate latest version
|
||||
shell: "source {{ default_user_home }}/.nvm/nvm.sh && nvm use node"
|
||||
|
||||
- name: Install Yarn
|
||||
shell: "source {{ default_user_home }}/.nvm/nvm.sh && npm install -g yarn"
|
||||
@@ -197,6 +197,12 @@ source "$HOME/.cargo/env"
|
||||
export GOBIN="$HOME/go/bin"
|
||||
export PATH="/usr/local/go/bin:$HOME/go/bin:$PATH"
|
||||
|
||||
################################################################
|
||||
# NVM #
|
||||
################################################################
|
||||
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
|
||||
################################################################
|
||||
# APPS #
|
||||
################################################################
|
||||
|
||||
Reference in New Issue
Block a user