Skip to content

Commit ec09d3f

Browse files
committed
feat: Added versioning capability
1 parent 4b872d2 commit ec09d3f

File tree

3 files changed

+21
-16
lines changed

3 files changed

+21
-16
lines changed

tasks/main.yml

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,42 @@
11
---
2-
- name: Rename nodejs directory
2+
- name: Remove old toolchain
33
become: true
4-
command: mv {{ nodejs_toolchain_dest }}/{{ toolchain_top_level_directory }} {{ nodejs_toolchain_dest }}/node
5-
args:
6-
creates: "{{ nodejs_toolchain_dest }}/node"
7-
when: toolchain_top_level_directory is defined
4+
file:
5+
path: "{{ nodejs_toolchain_final_dest }}"
6+
state: absent
7+
when:
8+
- toolchain_archive_contents.changed
9+
10+
- name: Move nodejs directory from tmp to opt
11+
become: true
12+
command: mv /tmp/{{ toolchain_top_level_directory }} {{ nodejs_toolchain_final_dest }}
13+
when:
14+
- toolchain_archive_contents.changed
15+
16+
- name: Create version file
17+
become: true
18+
copy:
19+
content: "{{ nodejs_toolchain_version }}"
20+
dest: "{{ nodejs_toolchain_final_dest }}/toolchain_version"
821

922
- name: Create node symlink
1023
become: true
1124
file:
12-
src: "{{ nodejs_toolchain_dest }}/node/bin/node"
25+
src: "{{ nodejs_toolchain_final_dest }}/bin/node"
1326
dest: /usr/local/bin/node
1427
state: link
1528

1629
- name: Create npm symlink
1730
become: true
1831
file:
19-
src: "{{ nodejs_toolchain_dest }}/node/bin/npm"
32+
src: "{{ nodejs_toolchain_final_dest }}/bin/npm"
2033
dest: /usr/local/bin/npm
2134
state: link
2235

2336
- name: Create npx symlink
2437
become: true
2538
file:
26-
src: "{{ nodejs_toolchain_dest }}/node/bin/npx"
39+
src: "{{ nodejs_toolchain_final_dest }}/bin/npx"
2740
dest: /usr/local/bin/npx
2841
state: link
2942

@@ -32,9 +45,3 @@
3245
template:
3346
dest: "{{ nodejs_toolchain_npmrc_dest }}"
3447
src: npmrc.j2
35-
36-
- include_tasks: setup-Debian.yml
37-
when: ansible_os_family == "Debian"
38-
39-
- include_tasks: setup-Darwin.yml
40-
when: ansible_os_family == "Darwin"

tasks/setup-Darwin.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

tasks/setup-Debian.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)