Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cc3b994

Browse files
committed
Fix displaying NodeJS version name and install arguments
1 parent 44f5ddb commit cc3b994

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
- name: Install nvm
22
hosts: localhost
33
vars:
4-
version: '{{ nodejs.version|default("lts") }}'
4+
version: '{{ nodejs.version|default("lts")|lower }}'
5+
version_text: "{% if 'lts' == version %}LTS{% else %}v{{ version }}{% endif %}"
56
nvm_version: '{{ nodejs.nvm_version|default("0.39.1") }}'
67
tasks:
78
- name: 'Install nvm v{{ nvm_version }}'
89
shell: 'curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v{{ nvm_version }}/install.sh | bash'
910
args:
1011
creates: /home/{{ ansible_user_id }}/.nvm/nvm.sh
1112

12-
- name: 'Install NodeJS v{{ version }}'
13-
shell: '/bin/bash -c "source ~/.nvm/nvm.sh && nvm install {{ version }}"'
13+
- name: 'Install NodeJS {{ version_text }}'
14+
vars:
15+
version_arg: "{% if 'lts' == version %}--lts{% else %}{{ version }}{% endif %}"
16+
shell: '/bin/bash -c "source ~/.nvm/nvm.sh && nvm install {{ version_arg }}"'
1417
args:
1518
creates: /home/{{ ansible_user_id }}/.nvm/alias

0 commit comments

Comments
 (0)