I used nvm to install two version of NodeJs using Ansible.
1) Install NVM: - name: install nvm sudo_user: go shell: > curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash
- name: change permission for nvm installation dir sudo_user: go command: bash -c 'chmod -R 777 ~/.nvm '
2) Install NodeJS 5.5.0 and 0.12.7 - name: install node v5.5.0 sudo_user: go command: bash -c '. ~/.nvm/nvm.sh; nvm install v5.5.0/0.12.7 ' environment: http_proxy: http://17.99.193.229:3128 https_proxy: http://17.99.193.229:3128
3) I didn't get any errors. 4) When I type "node -v", I got v5.5.0. 5) When I use "nvm ls" using "go" as user, I got: mkdir: cannot create directory `~': Permission denied node -> stable (-> N/A) (default) iojs -> N/A (default)
As you can see, I use sudo_user go for all the installtion, but I don't see the node I installed.