-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnvm.yml
29 lines (24 loc) · 914 Bytes
/
nvm.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
---
- name: Set Up nvm to manage node versions
hosts: localhost
become_user: "{{ username }}"
tasks:
- name: ensure the ~/projects directory is present
file: path=/home/{{ username }}/projects
state=directory
- name: clone nvm
git: repo=/~https://github.com/creationix/nvm.git
dest=/home/{{ username }}/projects/nvm
update=no
- name: create symlink to nvm
file: path=/home/{{ username }}/.nvm
src=/home/{{ username }}/projects/nvm
state=link
- name: set NVM_DIR in .bashrc
lineinfile: dest=/home/{{ username}}/.bashrc
regexp='export NVM_DIR'
line='export NVM_DIR="$HOME/.nvm"'
- name: source nvm in .bashrc
lineinfile: dest=/home/{{ username }}/.bashrc
regexp='nvm\.sh'
line='[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"'