-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathmain.yml
More file actions
55 lines (50 loc) · 1.65 KB
/
main.yml
File metadata and controls
55 lines (50 loc) · 1.65 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
---
# https://github.com/nvm-sh/nvm
- name: Install nvm
shell: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.4/install.sh | bash
args:
creates: "{{ ansible_facts['env']['HOME'] }}/.nvm/nvm.sh"
# https://nodejs.org/en/about/previous-releases
- name: Install Node.js 24.15.0
shell: |
export NVM_DIR="${HOME}/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install 24.15.0
nvm use 24.15.0
nvm alias default 24.15.0
args:
executable: /bin/bash
register: node_install
changed_when: "'is already installed' not in node_install.stderr"
- name: Upgrade npm
shell: |
export NVM_DIR="${HOME}/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
npm install -g npm@latest
args:
executable: /bin/bash
- name: Configure npm
shell: |
export NVM_DIR="${HOME}/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
npm config set ignore-scripts true
args:
executable: /bin/bash
# https://github.com/vinta/pangu.js
# https://github.com/raineorshine/npm-check-updates
# https://github.com/typescript-language-server/typescript-language-server
- name: Install global Node.js packages
shell: |
export NVM_DIR="${HOME}/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
npm install -g pangu
npm install -g npm-check-updates
npm install -g typescript typescript-language-server
args:
executable: /bin/bash
- name: Ensure Node.js environment is sourced in .zshrc
lineinfile:
dest: "{{ REPO_ROOT }}/dotfiles/.zshrc"
line: "source {{ REPO_ROOT }}/playbooks/roles/node/files/node_profile.sh"
state: present
when: ansible_facts["env"]["SHELL"] == "/bin/zsh"