Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install nodejs via nodenv #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion roles/common/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@

- include: hostname.yml
- include: tools.yml
- include: nodejs.yml
14 changes: 0 additions & 14 deletions roles/common/tasks/nodejs.yml

This file was deleted.

3 changes: 3 additions & 0 deletions roles/node/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
- include: nodeenv.yml
- include: nodejs.yml
30 changes: 30 additions & 0 deletions roles/node/tasks/nodeenv.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
- name: Install nodenv
git:
repo: https://github.com/nodenv/nodenv
dest: /home/{{ deploy_user }}/.nodenv
version: v{{ nodenv_version }}

- name: Add nodenv path line to shell config file
lineinfile:
line: export PATH="$HOME/.nodenv/bin:$PATH"
dest: /home/{{ deploy_user }}/.bashrc

- name: Add nodenv init line to shell config file
lineinfile:
line: eval "$(nodenv init -)"
dest: /home/{{ deploy_user }}/.bashrc

- name: Install node-build
git:
repo: https://github.com/nodenv/node-build.git
dest: /home/{{ deploy_user }}/.nodenv/plugins/node-build

# - name: Change nodenv owner to deploy user
# file:
# path: /home/{{ deploy_user }}/.nodenv
# state: directory
# owner: "{{ deploy_user }}"
# group: "{{ deploy_user }}"
# recurse: yes
# mode: 0755
11 changes: 11 additions & 0 deletions roles/node/tasks/nodejs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
- name: Install node
command: /home/{{ deploy_user }}/.nodenv/bin/nodenv install {{ nodenv_node_version }}

- name: Install node aliases
git:
repo: https://github.com/nodenv/nodenv-aliases.git
dest: /home/{{ deploy_user }}/.nodenv/plugins/node-aliases

- name: Set global node version
command: /home/{{ deploy_user }}/.nodenv/bin/nodenv global {{ nodenv_node_version }}
1 change: 1 addition & 0 deletions site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@
- elasticsearch
- backup
- logrotate
- node